|
13 | 13 | * The `ajax:aborted:file` event allows you to bind your own handler to process the form submission however you wish. |
14 | 14 | * |
15 | 15 | * Ex: |
16 | | - * $('form').live('ajax:aborted:file', function(){ |
17 | | - * // Implement own remote file-transfer handler here. |
| 16 | + * $('form').live('ajax:aborted:file', function(event, elements){ |
| 17 | + * // Implement own remote file-transfer handler here for non-blank file inputs passed in `elements`. |
18 | 18 | * // Returning false in this handler tells rails.js to disallow standard form submission |
19 | 19 | * return false; |
20 | 20 | * }); |
|
27 | 27 | * Required fields in rails.js |
28 | 28 | * =========================== |
29 | 29 | * |
30 | | - * If any required input field (input[required]) is blank then the AJAX form submission is cancelled. |
31 | | - * Note that unlike file uploads case here the whole form submission is cancelled ,by default. |
| 30 | + * If any blank required inputs (required="required") are detected in the remote form, the whole form submission |
| 31 | + * is canceled. Note that this is unlike non-blank file inputs, which still allow non-AJAX form submission. |
32 | 32 | * |
33 | 33 | * The `ajax:aborted:required` event allows you to bind your own handler to inform the user of blank required inputs. |
34 | 34 | * |
35 | | - * !! Note that Opera does not fire the form's submit event if there are blank required inputs, |
36 | | - * so this event may never get fired in Opera. |
| 35 | + * !! Note that Opera does not fire the form's submit event if there are blank required inputs, so this event may never |
| 36 | + * get fired in Opera. This event is what causes other browsers to exhibit the same submit-aborting behavior. |
37 | 37 | * |
38 | 38 | * Ex: |
39 | | - * $('form').live('ajax:aborted:required', function(){ |
40 | | - * // Returning false in this handler tells rails.js to submit the form anyway |
| 39 | + * $('form').live('ajax:aborted:required', function(event, elements){ |
| 40 | + * // Returning false in this handler tells rails.js to submit the form anyway. |
| 41 | + * // The blank required inputs are passed to this function in `elements`. |
41 | 42 | * return ! confirm("Would you like to submit the form with missing info?"); |
42 | 43 | * }); |
43 | 44 | */ |
|
0 commit comments