How to prevent the popup prematurely.

  • slfattorneys
    Asked on June 26, 2015 at 3:01 PM
    3. How to prevent the popup prematurely.
  • Sammy
    Replied on June 26, 2015 at 4:14 PM

    Considering thet you are embedding the full source code in your website, we can write javascript that validates the fields before submissions.

    Since you have few fields ill keep it simple, if no field is filled the popup wont be triggered, we will use the jquery validate plugin

    http://jqueryvalidation.org/documentation/

    Make sure you add the required tag to the fields you want validated

    <input id="email" type="mail" name="email" required>

    <script>
    jQuery("#myform").validate({
    submitHandler: function(form) {
    //Here is where we will cal the popup function only if the validation passes
    "validateForm('popup.html',400,200);
    }
    });
    </script>

    Use the fully qualified jquery name to prevent conflicts.

    Include the following in you html head section

    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.13.1/jquery.validate.min.js"></script>

     

    Kindly try the above and let me know if you need further assistance and clarification