Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling Validator twice breaks multiple dateinput #150

Closed
michan85 opened this issue Aug 27, 2010 · 1 comment
Closed

calling Validator twice breaks multiple dateinput #150

michan85 opened this issue Aug 27, 2010 · 1 comment

Comments

@michan85
Copy link

Description

calling validator more than once causes only last dateinput on page to show popup.

i came accross this while dynamically adding fields to a form, and then calling
validator again to ensure those fields get validated.

Reproduce

Copy HTML

<form method="post" action="ui.php?action=validate" class="form"><h2>Add a field</h2><ul><li><label for="date">date</label><input type="date" required="required" name="date" class="date"></li><li><label for="date">date</label><input type="date" required="required" name="date" class="date"></li></ul><script type="text/javascript">
    (function(){

        $(":date").dateinput();
        $(":range").rangeinput();
        $("form")
            .validator()
            .submit(function(e) {

            var form = $(this);

            // client-side validation OK.
            if (!e.isDefaultPrevented()) {

                // submit with AJAX
                $.post("ui.php?action=validate", form.serialize(), function(resp) {

                    alert( resp );
                });

                // prevent default form submission logic
                e.preventDefault();     
            }
        });
    })();
</script></form>

from fire bug console call

  • $("form").validator()

then click on a date input control

  • they should not pop up.

Work Around

comment out this code in
validator.js -> Validator -> destroy:
//inputs.unbind(conf.inputEvent || '').unbind("change.V");

@tipiirai
Copy link
Contributor

This is now fixed. here is the commit:

http://github.com/jquerytools/jquerytools/commit/3bf32e19998126e7bf0efa5ad80c9edb7dda0058

will be out in 1.2.5. Thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants