Changeset 13181
- Timestamp:
- 03/24/08 03:19:13 (8 months ago)
- Files:
-
- 1 added
- 2 modified
-
dijit/trunk/form/Form.js (modified) (2 diffs)
-
dijit/trunk/tests/form/test_Form_onsubmit.html (added)
-
dojo/trunk/_base/html.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/form/Form.js
r13004 r13181 346 346 }, 347 347 348 onSubmit: function( ){348 onSubmit: function(/*Event?*/e){ 349 349 // summary: 350 350 // Callback when user submits the form. This method is … … 354 354 // `onSubmit` is used to compute whether or not submission 355 355 // should proceed 356 return this.isValid(); // Boolean 356 357 if(!this.isValid()){ 358 if(e){ dojo.stopEvent(e); } 359 return false; // Boolean 360 } 361 return true; // Boolean 357 362 }, 358 363 -
dojo/trunk/_base/html.js
r13111 r13181 1043 1043 // If a third argument is passed, or if the second argumnt is a 1044 1044 // map of attributes, acts as a setter. 1045 // 1046 // When passing functions as values, note that they will not be 1047 // directly assigned to slots on the node, but rather the default 1048 // behavior will be removed and the new behavior will be added 1049 // using `dojo.connect()`, meaning that event handler properties 1050 // will be normalized and that some caveats with regards to 1051 // non-standard behaviors for onsubmit apply. Namely that you 1052 // should cancel form submission using `dojo.stopEvent()` on the 1053 // passed event object instead of returning a boolean value from 1054 // the handler itself. 1045 1055 // node: 1046 1056 // id or reference to the element to get or set the attribute on … … 1071 1081 // | "method": "POST", 1072 1082 // | "onsubmit": function(e){ 1083 // | // stop submitting the form. Note that the IE behavior 1084 // | // of returning true or false will have no effect here 1085 // | // since our handler is connect()ed to the built-in 1086 // | // onsubmit behavior and so we need to use 1087 // | // dojo.stopEvent() to ensure that the submission 1088 // | // doesn't proceed. 1073 1089 // | dojo.stopEvent(e); 1090 // | 1074 1091 // | // submit the form with Ajax 1075 1092 // | dojo.xhrPost({ form: "formId" });