Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1302

    I am trying to add a phone number filed into the contact field, I have renamed the current “Website” field on the existing contact form to Phone No, I wish to make this filed mandatory and also to check that a number NOT text is being entered in here.

    Can you help me please.

    #34776
    #34777

    Many Thanks for this but as this is a telephone number, I need to ensure that there is validation on the form to only allow number entry in this field how is this achieved what do I have to ALTER IN THE EXISTING CODE?

    #34778

    That’s possible by editing $.fn.kriesi_ajax_form in custom.js. I don’t have time to do that for you but here’s a tutorial on how to check contact forms with javascript: http://www.tizag.com/javascriptT/javascriptform.php

    I’d recommend to use cformsII or Contact Form 7 if you’re not familiar with javascript.

    The Dude

    #34779

    Dude,

    I cannot use cs forms or Contact Form & as these plugins conflict with the events plug I have. therfore my options are very limted along with my javavscript skills.

    I have managed to locate the code both the javascript and the php code I have taken what I think to be correct but I do need some help with both javascript and php what do I need to change ?

    Javascript code:

    function checkElements()

    {

    // reset validation var and send data

    send.validationError = false;

    send.datastring = ‘ajax=true’;

    send.formElements.each(function(i)

    {

    var currentElement = $(this),

    surroundingElement = currentElement.parent(),

    value = currentElement.val(),

    name = currentElement.attr(‘name’),

    classes = currentElement.attr(‘class’),

    nomatch = true;

    send.datastring += “&” + name + “=” + value;

    if(classes.match(/is_empty/))

    {

    if(value == ”)

    {

    surroundingElement.attr(“class”,””).addClass(“error”);

    send.validationError = true;

    }

    else

    {

    surroundingElement.attr(“class”,””).addClass(“valid”);

    }

    nomatch = false;

    }

    if(classes.match(/is_email/))

    {

    if(!value.match(/^w[w|.|-]+@w[w|.|-]+.[a-zA-Z]{2,4}$/))

    {

    surroundingElement.attr(“class”,””).addClass(“error”);

    send.validationError = true;

    }

    else

    {

    surroundingElement.attr(“class”,””).addClass(“valid”);

    }

    nomatch = false;

    }

    if(nomatch && value != ”)

    {

    surroundingElement.attr(“class”,””).addClass(“valid”);

    }

    });

    if(send.validationError == false)

    {

    send_ajax_form();

    }

    return false;

    }

    });

    }

    })(jQuery);

    PHP Code

    <form action=”” method=”post” class=”ajax_form”>

    <fieldset><?php if (!isset($errorC) || $errorC == true){ ?><h3><span><?php _e(‘Send us mail’,’avisio’); ?></span></h3>

    <p class=”<?php if (isset($the_nameclass)) echo $the_nameclass; ?>” ><input name=”yourname” class=”text_input is_empty” type=”text” id=”name” size=”20″ value=’<?php if (isset($the_name)) echo $the_name?>’/><label for=”name”><?php _e(‘Your Name’,’avisio’); ?>*</label></p>

    <p class=”<?php if (isset($the_emailclass)) echo $the_emailclass; ?>” ><input name=”email” class=”text_input is_email” type=”text” id=”email” size=”20″ value=’<?php if (isset($the_email)) echo $the_email ?>’ /><label for=”email”><?php _e(‘E-Mail’,’avisio’); ?>*</label></p>

    <p class=”<?php if (isset($the_numberlass)) echo $the_numberclass; ?>” ><input name=”phone” class=”text_input is_empty” type=”text” id=”phone” size=”20″ value=’<?php if (isset($the_number)) echo $the_number ?>’ /><label for=”phone”><?php _e(‘Phone No’,’avisio’); ?>*</label></p>

    #34780

    Sorry I don’t have time to help you with that. At the moment I’m answering many requests alone – maybe if I’ve more spare time I can help you. You can ask for help in this thread though: http://themeforest.net/forums/thread/so-you-know-how-to-customize-a-template-and-want-to-make-some-money/24795?page=10

    The Dude

    #34781

    I am very frustrated with this response, I have purchase over 5 of these themes and I don,t expect to have to goto a freelancer for such a basic support request, perhaps you need to get more help.

    I need to have this function in the theme I cant be the only person using these templates who needs to have a phone number validated on the contact form?

    I look forward to your help in solving this matter

    #34782

    I have the same problem, any solution?

    #34783

    Hi,

    This feature is a bit complicated. Like Peter said you may need to hire a freelancer developer to add the feature.

    Regards,

    Ismael

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Adding Phone Number in Contact Field’ is closed to new replies.