开发者

contact form validation problem (Validation is bypassed on send button)

I am using livevalidation script on my contact form.But i dont know what is the problem whenever i click submitt or send button. It just only checks the dropdown selection and other fields go empty and form is validated. I checked every example on livevalidation site but no 开发者_高级运维help. Mine is not working.... It dont check the presense function in all my fields........I dont know what to do

You can check my contact page online here.link text

If you need code then i am pasting it here toooooo........

Code for form is here

 <div class="subFillC">
        <form id="form1" action="contactengine.php" method="post" name="form1">
          <p><label for="name">Name</label> <input type="text" name="name" id="Name" size=
          "30" /> </p>

          <p><label for="email">Email</label> <input type="text" name="email" id="Email" size=
          "30" /></p>

          <p><label for="web">Select Option</label> <select name="service" id="service">
            <option value="None" selected="selected">
              None
            </option>

            <option value="Website Design">
              Website Design
            </option>

            <option value="Website Redesign">
              Website Redesign
            </option>

            <option value="Logo/Corporate Design">
              Logo Design/Corporate Design
            </option>

            <option value="Other">
              Other
            </option>
          </select></p>

          <p><label for="email">What is <img src="images/cap.jpg" width="50" height=
          "15" /></label> <input type="text" name="cap" id="cap" size="30" /></p>

          <p><label for="message">Message</label>
          <textarea id="Messagefield" name="message" cols="30" rows="10"></textarea>

Send

And in the end i have script just after the form tag which is below

new LiveValidation('Name', { wait: 500 }).add(Validate.Presence);new LiveValidation('Email', { wait: 500 }).add(Validate.Email); new LiveValidation('Messagefield', { wait: 500 }).add(Validate.Presence);var service = new LiveValidation('service' , {onlyOnSubmit: true });service.add( Validate.Exclusion, { within: [ 'None' ] } );


You are not correctly calling validation for all the fields. You must make an instance of LiveValidation object before calling the add function.

For each field (Name, Email, MessageField) replace:

new LiveValidation('Name', { wait: 500 }).add(Validate.Presence);

With:

var LV_Name = new LiveValidation('Name', { wait: 500 });
LV_Name.add(Validate.Presence);    

Here is complete JS snippet with LiveValidation placed inside document.ready jQuery function that will execute when DOM is ready:

<script type="text/javascript" src="contact_files/jquery.js"></script>
<script type="text/javascript" src="contact_files/livevalidation_standalone.js"></script><!-- Let's do the animation -->
<script type="text/javascript">
//<![CDATA[
$(function() {

    var LV_Name = new LiveValidation('name',{ wait: 500 });
    LV_Name.add(Validate.Presence);

    var LV_Email = new LiveValidation('email', {onlyOnSubmit: true });
    LV_Email.add(Validate.Presence);

    var LV_Message= new LiveValidation('message', { wait: 500 });
    LV_Message.add(Validate.Presence);

    var service = new LiveValidation('service' , {onlyOnSubmit: true });
    service.add( Validate.Exclusion, { within: [ 'None' ] } );

    // set opacity to nill on page load
    $("ul#menu span").css("opacity","0");
    // on mouse over
    $("ul#menu span").hover(function () {
        // animate opacity to full
        $(this).stop().animate({
            opacity: 1
            }, 'slow');
        },
        // on mouse out
        function () {
            // animate opacity to nill
            $(this).stop().animate({
                opacity: 0
                }, 'slow');
            });
    });
//]]>
</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜