forked from GNUsocial/gnu-social
		
	Enhancement for 'ajax' form class: submit buttons behave more like normal submissions, submitting their name/values through a hidden field.
This should work well for simple cases, but could conceivably create false positives if there's a click handler on the specific buttons, depending on whether event processing passes it on. Double-check if you're doing such forms along with the 'ajax' class!
This commit is contained in:
		
							
								
								
									
										12
									
								
								js/util.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								js/util.js
									
									
									
									
									
								
							| @@ -1464,6 +1464,18 @@ var SN = { // StatusNet | ||||
|                 SN.U.FormXHR($(this)); | ||||
|                 return false; | ||||
|             }); | ||||
|             $('form.ajax input[type=submit]').live('click', function() { | ||||
|                 // Some forms rely on knowing which submit button was clicked. | ||||
|                 // Save a hidden input field which'll be picked up during AJAX | ||||
|                 // submit... | ||||
|                 var button = $(this); | ||||
|                 var form = button.closest('form'); | ||||
|                 form.find('.hidden-submit-button').remove(); | ||||
|                 $('<input class="hidden-submit-button" type="hidden" />') | ||||
|                     .attr('name', button.attr('name')) | ||||
|                     .val(button.val()) | ||||
|                     .appendTo(form); | ||||
|             }); | ||||
|         }, | ||||
|  | ||||
|         /** | ||||
|   | ||||
							
								
								
									
										2
									
								
								js/util.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								js/util.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user