So in the cold light of day, this is a problem that arose after
upgrade to jquery 1.3 and not with the ui - for anyone googling the
fix I eventually used is to bind a function to the submit button,
prevent the default action of the submit button, and then append some
html to the form before calling submit on the form itself.
$(document).ready(function(){
$("#contact_submit").bind("click", function(e){
e.preventDefault();
$("#dialog").dialog({ modal: true,
buttons: {
'No': function() {
$("#new_contact").append("<input id=\"show_org\" type=
\"hidden\" value=\"false\" name=\"show_org\"/>")
$("#new_contact").submit();
$(this).dialog('close');
},
'Yes': function() {
$("#new_contact").append("<input id=\"show_org\" type=
\"hidden\" value=\"true\" name=\"show_org\"/>")
$("#new_contact").submit();
$(this).dialog('close');
}
}
});
return false;
});
});
On Feb 5, 12:15 am, chrispanda <[email protected]> wrote:
> I'm trying to bind to the submit function, pop up a dialog box, and
> set a value on a hidden field before a page is submitted.
>
> It's late here, and I'm pretty new to the JQuery UI stuff so not sure
> if this is me or a bug - but I think this code was working and has
> broken with the upgrade to rc6 - the only change I made was to take
> out the overlay. Instead of waiting for a button click, it now falls
> straight through and submits the form.
>
> Any thoughts much appreciated.
>
> $(document).ready(function(){
> $("#new_contact").submit(function(){
> $("#dialog").dialog({ modal: true,
> buttons: {
> 'Yes': function() {
> $("#show_org").val(true)
> $(this).dialog('close');
> return true;
> },
> 'No': function() {
> $("#show_org").val(false)
> $(this).dialog('close');
> return true;
> }
> }});
>
> return false;
> });
> });
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---