jQuery UI Dialog with Form Validation Plugin

前端 未结 5 999
轻奢々
轻奢々 2021-02-09 22:41

I am currently using the bassistance validation plugin for my forms. And I am using a pop-up modal dialog box to house a form that needs to be validated, but for some reason it

5条回答
  •  后悔当初
    2021-02-09 23:20

    I had the same issue using jQuery Dialog plugin (http://jqueryui.com/dialog/) with jQuery Validator plugin(http://jqueryvalidation.org/). The problem is that the jQuery-UI dialog does not append to the form, it appends just before , so the elements to validate are outside the

    section.

    To solve this issue i add the "open" attribute on the Dialog initialization. Inside this attribute i add a function that wraps my Dialog div element inside a form element and then initialize the validator.

    Also, i add the "close" attribute on the Dialog initialization. Inside this attribute i add a function that unwraps the form i wrapped on the open event and resets the validator.

    A simple example,

    
    

    Some html for the above javascript,

    Create a thematic section for a conference type.

提交回复
热议问题