Mortalus
Mortalus

Reputation: 10712

Jquery dialog does not disabled all the inputs and buttons

I Use jQuery Dialog to display a details form when creating a new user. I want to disable a form while performing an ajax request to the server to create the actual user in the DB.

I use $("#UserDetailsDialog").dialog("disable"); method to disable the dialog.

it seems that this method only affects the UI that makes the dialog half-transparent but does not actually doable the input fields and\or buttons of the dialog:

here is a code sample: fiddle-code


EDIT:

I have filed a ticket for jQuery-UI Dev. team and got a quick "duplicate" reply. It seems that the $("#myDialog").dialog("disable") method for jQuery-UI Dialog will not disable the inputs but will change only the UI to look like it is disabled. This feature is indeed not documented well enough. here is a link to the tikect: dialog('disable') does not disable OK/Cancel buttons inside dialog

Upvotes: 1

Views: 327

Answers (2)

Andrew Whitaker
Andrew Whitaker

Reputation: 126042

Nothing, it looks like. There isn't much documentation on the disable method or what its actually supposed to do.

Apparently the disable method/option doesn't affect the contents of the dialog (or the buttons, which is a little weird), just the dialog itself. If you want to disable the inputs on the dialog I would disabling the buttons/inputs manually as well:

$("#UserDetailsDialog").dialog("disable")
    .closest(".ui-dialog")
    .find(":input")
    .prop("disabled", true);

Example: http://jsfiddle.net/andrewwhitaker/p7tV7/15/

Upvotes: 2

sbr
sbr

Reputation: 4823

Try :

$( "#UserDetailsDialog" ).dialog( "option", "disabled", true );

Upvotes: 0

Related Questions