Question

Am building a jquerymobile app that has multiple forms on a page like so:

    <form id="remember_form" action="#" method="post" enctype="application/x-www-form-urlencoded" parsley-validate>
            <input type="email" name="rem_email" required parsley-error-container="#remember_validation" parsley-error-message="Email address is required" title="Email required" placeholder="Email" data-icon="x" class="login_controls">
            <div style="padding-bottom:10px;"></div>
            <a href="#" style="text-shadow:none;" id="remem_psswd" class="enviar">Get Password</a>
        </form>

In my js file, i have this:

if ($('#remember_form').parsley( 'validate' ) == true){
    $.mobile.changePage('#main');   
}

My problem is that parsley.js validates all the forms on the page. How do i prevent this behaviour

Était-ce utile?

La solution

I had to do something like this in js:

if ($('#remember_form').parsley( 'validate' ) == true){

}

calling parsley( 'validate' ) for each form only validates that form

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top