jQuery UI Widgets Forums Form Validator onSuccess ?

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 4 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Validator onSuccess ? #108181


    I have the following javascript on my contact page, and it has two bugs that I just can’t figure out. The page comes up fine, and if you fail one of the rules it displays the notice. But, if you just hit the “Submit” button it displays the alert correct but once you click on the “OK,” the alert goes away and the page submits the form? Likewise, if the form fails validation and you press the submit button the form gets posted. Both of these actions are not correct, but I just can’t see what I doing wrong. Please note that the {{year}} is a place holder for some text, and is working fine.

    Any ideas?

    <script language=”javascript” type=”text/javascript”>
    $(document).ready(function () {
    $(‘#clientForm’).jqxValidator({ rules: [
    { input: ‘#telephone’, message: ‘A valid ten digit telephone number is required’, action: ‘blur’, rule: ‘required’},
    { input: ‘#telephone’, message: ‘Please enter ten digit telephone number’, action: ‘blur’, rule: ‘length=10, 16’},
    { input: ‘#email_address’, message: ‘A valid email address is required’, action: ‘blur’, rule: ‘required’},
    { input: ‘#email_address’, message: ‘Please enter a valid email address’, action: ‘blur’, rule: ’email’},
    { input: ‘#name’, message: ‘Your name is required’, action: ‘blur’, rule: ‘required’},
    { input: ‘#name’, message: ‘Please enter your name’, action: ‘blur’, rule: ‘length=5, 64’},
    { input: ‘#note’, message: ‘Please enter a message’, action: ‘blur’, rule: ‘length=10, 1024’},
    { input: ‘#captcha’, message: ‘Captcha is required’, action: ‘blur’, rule: ‘required’},
    { input: ‘#captcha’, message: ‘Please re-enter the captcha’, action: ‘blur’, rule: function () {
    var testInput = “{{year}}”;
    var testSample = document.getElementById(‘captcha’).value;
    var result = testInput == testSample;
    return result; }}] });
    $(‘#mySubmit’).jqxButton({ width: 100, height: 30});
    $(‘#mySubmit’).click(function () { $(‘#clientForm’).jqxValidator(‘validate’); });
    $(‘#clientForm’).on(‘validationError’, function(event) {alert(‘Please complete the form’) });
    $(‘#clientForm’).on(‘validationSuccess’, function(event) { $(‘#clientForm’).submit() });

    Thank you,


    Validator onSuccess ? #108212


    Hello Ashley,

    I try to recreate your case but it does not submit the form while it is not validated correctly.
    I tested this example and it seems to work fine:
    With additional included events as in your case.
    Could you provide a whole example and the steps to reproduce it?

    Best Regards,
    Hristo Hristov

    jQWidgets team

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

You must be logged in to reply to this topic.