Add disable_submit_button() global JS function
				
					
				
			managed to find another use for this, so split it out
This commit is contained in:
		
							parent
							
								
									5765533491
								
							
						
					
					
						commit
						802f4bfd6b
					
				
					 1 changed files with 15 additions and 12 deletions
				
			
		|  | @ -40,6 +40,20 @@ function disable_button(button, label) { | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| function disable_submit_button(form, label) { | ||||
|     // for some reason chrome requires us to do things this way...
 | ||||
|     // https://stackoverflow.com/questions/16867080/onclick-javascript-stops-form-submit-in-chrome
 | ||||
|     // https://stackoverflow.com/questions/5691054/disable-submit-button-on-form-submit
 | ||||
|     var submit = $(form).find('input[type="submit"]'); | ||||
|     if (! submit.length) { | ||||
|         submit = $(form).find('button[type="submit"]'); | ||||
|     } | ||||
|     if (submit.length) { | ||||
|         disable_button(submit, label); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /* | ||||
|  * Load next / previous page of results to grid.  This function is called on | ||||
|  * the click event from the pager links, via inline script code. | ||||
|  | @ -208,18 +222,7 @@ $(function() { | |||
|     $('a.button.autodisable').click(function() { | ||||
|         disable_button(this); | ||||
|     }); | ||||
|     // for some reason chrome requires us to do things this way...
 | ||||
|     // https://stackoverflow.com/questions/16867080/onclick-javascript-stops-form-submit-in-chrome
 | ||||
|     // https://stackoverflow.com/questions/5691054/disable-submit-button-on-form-submit
 | ||||
|     $('form.autodisable').submit(function() { | ||||
|         var submit = $(this).find('input[type="submit"]'); | ||||
|         if (! submit.length) { | ||||
|             submit = $(this).find('button[type="submit"]'); | ||||
|         } | ||||
|         if (submit.length) { | ||||
|             disable_button(submit); | ||||
|         } | ||||
|     }); | ||||
|     $('form.autodisable').submit(disable_submit_button); | ||||
| 
 | ||||
|     /* | ||||
|      * enhance dropdowns | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar