Posted By

marcusleemitchell on 11/13/10


Tagged

jquery dialog caller


Versions (?)

jQuery Dialog with Known Caller


 / Published in: JavaScript
 

  1. $(function(){
  2. // jQuery UI Dialog
  3. $('#dialog').dialog({
  4. autoOpen: false,
  5. width: 400,
  6. modal: true,
  7. resizable: false,
  8. buttons: {
  9. "Confirm": function() {
  10. // submit the form that called the dialog :s
  11. document.forms["vote_campaign_edit"].submit();
  12. },
  13. "Cancel": function() {
  14. $(this).dialog("close");
  15. }
  16. }
  17. });
  18.  
  19. $('form#vote_campaign_edit').submit(function(){
  20. $('#dialog').dialog('open');
  21. return false;
  22. });
  23.  
  24. $('form.formtastic.vote_shop').submit(function(){
  25. $('#dialog').dialog('open');
  26. return false;
  27. })
  28. });

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: marcusleemitchell on November 13, 2010
  1. in the DOM there are many form elements with class="formtastic vote_shop", all have unique id values
  2. ln:24 and ln:25 causes a dialog to open when these forms are submitted as dialog#open is called on submit
  3. ln:10 here i need for the id of the calling form submit button to be known so i can submit just that form

You need to login to post a comment.