I wanted a prompt dialog when they entered a note to pop up.
Unfortunately, it pulls the dialog outside of the form element. What I
think I want to do is to pull the dialog element back into the form
when I press confirm. Can you help me think through the best way to do
this? I'm going to take a stab at it. Let me know if there's a better
way to do this.
example html:
<asp:LinkButton ID="btnAddNote" runat="server" Text="Add Note"
CssClass="DialogNoteInputButton" OnClick="btnAddNote_Click" />
<div id="dialogNote" title="Add Note">
<p>
<asp:TextBox ID="txtNote" runat="server" Rows="10" Width="95%"
TextMode="MultiLine"></asp:TextBox>
</p>
</div>
script:
$(function() {
setupDialogRevert(".DialogNoteInputButton", "#dialogNote")
}
function setupDialogRevert(DialogSelector, ButtonSelector) {
var d = $(DialogSelector);
d.each(function() {
var parent = d.parent();
d.data("oldParent", parent);
});
d.dialog({
bgiframe: true,
resizable: true,
modal: true,
autoOpen: false,
width: 350,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
buttons: {
DialogOkButton: function(event) {
$(this).dialog('close');
var button = $(this).data("button");
$(this).appendTo($(this).data("oldParent"));
$(button).data("IsConfirmed", true);
button.click();
showProcessingDialog();
},
Cancel: function() {
$(this).dialog('close');
}
}
});
d.children(":button:contains('DialogOkButton')").attr
("DialogButtonType", "Ok").empty().prepend("Ok");
$(ButtonSelector)
.data("IsConfirmed", false)
.data("dialog", d)
.bind("click", {}, openDialogRevert);
}
function openDialogRevert(event) {
if (!$(this).data("IsConfirmed")) {
$(":button[DialogButtonType='Ok']").empty().prepend
(this.innerHTML);
$(this).data("dialog").data("button", this).dialog('open');
return false;
} else {
$(this).data("IsConfirmed", false);
return true;
}
}
--
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en.