Changeset 13181

Show
Ignore:
Timestamp:
03/24/08 03:19:13 (8 months ago)
Author:
alex
Message:

update docs and default behavior for dijit.Form and dojo.attr to make it crystal clear that unified Dojo event handling is in play when using event handlers specified by dojo.attr() and that browser-specific hacks may no longer work as expected. Fixes #6280. !strict

Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/form/Form.js

    r13004 r13181  
    346346                }, 
    347347                 
    348                 onSubmit: function(){  
     348                onSubmit: function(/*Event?*/e){  
    349349                        //      summary: 
    350350                        //              Callback when user submits the form. This method is 
     
    354354                        //              `onSubmit` is used to compute whether or not submission 
    355355                        //              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 
    357362                }, 
    358363 
  • dojo/trunk/_base/html.js

    r13111 r13181  
    10431043                //              If a third argument is passed, or if the second argumnt is a 
    10441044                //              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. 
    10451055                //      node: 
    10461056                //              id or reference to the element to get or set the attribute on 
     
    10711081                //      |               "method": "POST", 
    10721082                //      |               "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. 
    10731089                //      |                       dojo.stopEvent(e); 
     1090                //      | 
    10741091                //      |                       // submit the form with Ajax 
    10751092                //      |                       dojo.xhrPost({ form: "formId" });