Make all form fields required

Discussion in 'Local Business WordPress Theme' started by bparham, Aug 6, 2013.

  1. bparham

    bparham New Member

    Joined:
    Aug 3, 2013
    Messages:
    1
    Likes Received:
    0
    I would like for all of the fields on the lead capture form to be required in order for a user to submit a form. When reviewing the code in the localbusiness-leads-form.php file, it appears that all of the forms are set to be required by default, however the lead capture form on my site will submit fine as long as the user submits just an email address. It does not appear to be enforcing the class="required text requiredField" that is a part of each field code. Any suggestions? Here is the code of that php file:

    <form action="<?php get_template_directory(); ?>" class="signupform" id="contactForm" method="post">
    <input type="text" name="uname" id="uname" onfocus="if (this.value == 'Your Name') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Your Name';}" value="Your Name" value="<?php if (isset($_POST['uname']))
    echo $_POST['uname']; ?>" class="required text requiredField"/>
    <?php if ($nameError != '') { ?>
    <span class="error"> <?php echo $nameError; ?> </span>
    <br/>
    <?php } ?>
    <br/>
    <input class="required text requiredField email" type="text" name="email" id="email" onfocus="if (this.value == 'Your E-mail') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Your E-mail';}" value="Your E-mail" value="<?php if (isset($_POST['email']))
    echo $_POST['email']; ?>"/>
    <br/>
    <input class="required text requiredField numeric" type="text" name="contact" id="contact" onfocus="if (this.value == 'Contact Number') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Contact Number';}" value="Contact Number" value="<?php if(isset($_POST['contact'])) echo $_POST['contact'];?>"/>
    <br/>
    <textarea name="comments" id="comments" class="required message requiredField" type="textarea" onfocus="if (this.value == 'Address of your rental property') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Address of your rental property';}"/>Address of your rental property<?php if(isset($_POST['comments'])) { if(function_exists('stripslashes')) { echo $_POST['comments']; } else { echo $_POST['comments']; } } ?></textarea>
    <?php $captcha_option = inkthemes_get_option('capt_en');
    $captcha_option_on = "on";
    if ($captcha_option === $captcha_option_on) { ?>
    <input type="hidden" name="captcha" id="captcha" value="<?php $capt=$a->ink_capt1(); $capt1=$a->ink_capt2();
    echo $addcapt=$capt+$capt1;?>"/>
    <input type="text" name="vercode" id="vercode" onfocus="if (this.value == 'Captcha Sum') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Captcha Sum';}" value="Captcha Sum" value="<?php if(isset($_POST['vercode'])) echo $_POST['vercode'];?>"/>
    <span class="captcha_img"><?php echo $capt.'+'.$capt1; ?></span>
    <?php if($_POST['vercode']!=$_POST['captcha']){
    echo "<div class='captcha_color'> <p>Enter valid captcha!</p></div>";
    $capfail=true;
    } ?>
    <?php } //captcha on/off ?>
    <input class="btnsubmit" type="submit" name="submit" value="Request Quote"/>
    <input type="hidden" name="randvalue" id="randvalue" value="<?php echo rand(); ?>" />
    </form>
     
  2. Gourav

    Gourav Support Staff

    Joined:
    Oct 19, 2012
    Messages:
    7,728
    Likes Received:
    207
    Unfortunately there isn't a way to do that with our theme unless you custom code something up. Sorry.
     

Share This Page