[jquery-ui] Submit prevented form
Hi, In a form, there are 2 inputs (type = submit). I prevented the submit in order to use a dialog. For example, on the input 1 click event : $('#mySubmit1').click( function (e) { e.preventDefault(); // prevent the submit action [...] $dialog.dialog( { [...] buttons: { 'Ok': function() { $(this).dialog('close'); $('#mySubmit1').closest('form').submit() }, 'Cancel': function() { $(this).dialog('destroy'); } } } ); } ); If I click submit input 1, I'd like dialog submits my form with input 1. If I click submit input 2, I'd like dialog submits my form with input 2 (input 1 must not be posted) In my example code, no one input (type = submit) is posted. Is there a way to post the value of the clicked submit input ? Many thanks. Cyril -- You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to jquery...@googlegroups.com. To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.
Re: [jquery-ui] Submit prevented form
I would suggest using a hidden input or 2. Using jquery you can easily set them to be disabled and then they will not submit. input name=somename type=hidden value=somevalue/ then you could use $('[name=somename]').attr('disabled','') to enable $('[name=somename]').attr('disabled','disabled') to disable When you call submit() on a form, there is no submit button being clicked, so it doesn't send submit button values. On Wed, Jan 13, 2010 at 3:11 PM, Cyril Lopez loveisthe...@gmail.com wrote: Hi, In a form, there are 2 inputs (type = submit). I prevented the submit in order to use a dialog. For example, on the input 1 click event : $('#mySubmit1').click( function (e) { e.preventDefault(); // prevent the submit action [...] $dialog.dialog( { [...] buttons: { 'Ok': function() { $(this).dialog('close'); $('#mySubmit1').closest('form').submit() }, 'Cancel': function() { $(this).dialog('destroy'); } } } ); } ); If I click submit input 1, I'd like dialog submits my form with input 1. If I click submit input 2, I'd like dialog submits my form with input 2 (input 1 must not be posted) In my example code, no one input (type = submit) is posted. Is there a way to post the value of the clicked submit input ? Many thanks. Cyril -- You received this message because you are subscribed to the Google Groups jQuery UI group. To post to this group, send email to jquery...@googlegroups.com. To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en. -- Best regards, Balázs Suhajda -- You received this message because you are subscribed to the Google Groups jQuery UI group. To post to this group, send email to jquery...@googlegroups.com. To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.
Re: [jquery-ui] Submit prevented form
2010/1/13 Balázs Suhajda suhaj...@gmail.com I would suggest using a hidden input or 2. Using jquery you can easily set them to be disabled and then they will not submit. Thanks for the tip Balázs ! Cyril input name=somename type=hidden value=somevalue/ then you could use $('[name=somename]').attr('disabled','') to enable $('[name=somename]').attr('disabled','disabled') to disable When you call submit() on a form, there is no submit button being clicked, so it doesn't send submit button values. On Wed, Jan 13, 2010 at 3:11 PM, Cyril Lopez loveisthe...@gmail.com wrote: Hi, In a form, there are 2 inputs (type = submit). I prevented the submit in order to use a dialog. For example, on the input 1 click event : $('#mySubmit1').click( function (e) { e.preventDefault(); // prevent the submit action [...] $dialog.dialog( { [...] buttons: { 'Ok': function() { $(this).dialog('close'); $('#mySubmit1').closest('form').submit() }, 'Cancel': function() { $(this).dialog('destroy'); } } } ); } ); If I click submit input 1, I'd like dialog submits my form with input 1. If I click submit input 2, I'd like dialog submits my form with input 2 (input 1 must not be posted) In my example code, no one input (type = submit) is posted. Is there a way to post the value of the clicked submit input ? Many thanks. Cyril -- You received this message because you are subscribed to the Google Groups jQuery UI group. To post to this group, send email to jquery...@googlegroups.com. To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.comjquery-ui%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en. -- Best regards, Balázs Suhajda -- You received this message because you are subscribed to the Google Groups jQuery UI group. To post to this group, send email to jquery...@googlegroups.com. To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.comjquery-ui%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en. -- You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to jquery...@googlegroups.com. To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.