Opened 10 years ago

Closed 10 years ago

#9200 closed bug (notabug)

Modal Dialog incompatible with jquery-validate

Reported by: ohcibi Owned by: ohcibi
Priority: minor Milestone: none
Component: ui.dialog Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description

Demo: http://jsfiddle.net/YTwFY/2/

I've included jQuery-ui 1.10.2 manually in this fiddle as jsfiddle doesn't support it yet.

Steps to reproduce:

  1. Enter some text into the first input field (name="name")
  2. Hit the enter key on your keyboard

Expected:

  • Error is shown as pinCode is still empty.
  • Form doesn't get submitted
  • Dialog gets opened

What goes wrong:

  • Error is not shown
  • Form is submitted

What goes right:

  • Dialog gets opened

If the first input field is empty or the focus is on the second field or the submit button is clicked, everything is working correctly.

Workaround:

Delay the opening of the dialog by 1 ms:

invalidHandler: function() {
//...
  setTimeout(function() { 
    $('#dialog-confirm').dialog({
      //...
    });
  }, 1);
//..
}

Change History (3)

comment:1 Changed 10 years ago by Scott González

Component: ui.coreui.dialog
Owner: set to ohcibi
Status: newpending

I get a 404 for that fiddle.

Can you provide a reduced test case that doesn't include the validation plugin? As long as that's included, it's not clear where or what the problem is.

comment:2 Changed 10 years ago by ohcibi

Status: pendingnew

I forgot to add my username into the link, after I edited. This one will work: http://jsfiddle.net/ohcibi/YTwFY/2/ (can't edit the issue directly).

To provide an example without the validation plugin is a tough one as this is what the problem is about. The validation isn't triggered correctly if the dialog is opened inside the invalidHandler of the validation plugin and the above conditions met. Maybe this is rather a jquery-validate bug?

comment:3 Changed 10 years ago by Scott González

Resolution: notabug
Status: newclosed

We're not going to dig through all of the validation code to figure out where the incompatibility is. Perhaps Jörn will know off the top of his head. My guess is that he'll miss this discussion unless you file an issue against the validation plugin since he's on vacation right now.

Note: See TracTickets for help on using tickets.