0
votes

Hi I am using verifyjs to validate my form. But I want to write some code on submit button click and if form validate, I never want to submit form, I am just using 'form' for validation. $('form').valid() is not valid, how can i validate my form on button click? So;

 <form>
        <input type="text" data-validate="number" />

        <input type="radio" name="a" value="asd" data-validate="required" />
        <input type="radio" name="a" value="asd1" data-validate="required" />
        <input type="radio" name="a" value="asd2" data-validate="required" />
        <input type="button" value="submit" onclick="abc();" />
    </form>
<script>


function abc() {
    if ($('form').valid()) { // like this. But valid() is not working in verifyjs. 


        alert('ok');
    }
}

1
Please be more careful when using tags. The jquery-validate plugin is not the same as verify.js.Sparky
You can't use .valid() because it is not a method provided to you by the verify.js plugin. .valid() does not exist. The documentation does not seem to provide a method for a boolean test of the form.Sparky
Sparky, Thanks for your answer, I already dont use. I just want to know, If there is a method like in jquery-validate.Erkan
AS per docs, Verify does not appear to have a method that's functionally equivalent to .valid().Sparky

1 Answers

0
votes

Try $("#my-form").validate(...) for complete form or $("#my-text-input").validate(...) for inputs