Saturday, October 8, 2011

Preventing of Submiting JQuery.UI Dialogs on Return

Look at the usual JQuery.UI dialog example. It works the same way as the official site example - you can press Enter in the fields and nothing will happen. But check out this one. It submits the form (dialog).

You may think that the workaround is to add a hidden input field:

<input type="hidden" />

but it doesn't work. Adding the normal text input hidden by css will help:

<input type="text" style="display: none;" />

Another way is to remove the <form> tag, but it isn't suitable if you have many fields and want use serialize.

No comments:

Post a Comment