Ticket #6005: FormValidation.2.3.patch
| File FormValidation.2.3.patch, 2.6 kB (added by nathan, 11 months ago) |
|---|
-
dijit/tests/form/Form.html
130 130 http://www.tipjar.com/cgi-bin/test --> 131 131 <form dojoType="dijit.form.Form" id="myForm" encType="multipart/form-data" action="" method="" 132 132 onreset="return confirm('Press OK to reset widget values')" 133 onsubmit="alert('Attempting to submit form w/values:\n'+dojo.toJson(this.getValues(),true));if(this. isValid()){return confirm('Form is valid, press OK to submit');}else{alert('Form contains invalid data. Please correct first');return false;}"133 onsubmit="alert('Attempting to submit form w/values:\n'+dojo.toJson(this.getValues(),true));if(this.validate()){return confirm('Form is valid, press OK to submit');}else{alert('Form contains invalid data. Please correct first');return false;}" 134 134 > 135 135 <p>Just HTML text</p> 136 136 <table border=2> -
dijit/form/ValidationTextBox.js
105 105 } 106 106 } 107 107 this.displayMessage(message); 108 return isValid; 108 109 }, 109 110 110 111 // currently displayed message … … 169 170 170 171 validate: function(){ 171 172 this.valueNode.value = this.toString(); 172 this.inherited(arguments);173 return this.inherited(arguments); 173 174 }, 174 175 175 176 setAttribute: function(/*String*/ attr, /*anything*/ value){ -
dijit/form/Form.js
33 33 }); 34 34 }, 35 35 36 validate: function(){ 37 // summary: returns if the form is valid - same as isValid - but 38 // provides a few additional (ui-specific) features. 39 // 1 - it will highlight any sub-widgets that are not 40 // valid 41 // 2 - it will call focus() on the first invalid 42 // sub-widget 43 var didFocus = false; 44 return dojo.every(dojo.map(this.getDescendants(), function(widget){ 45 // Need to set this so that "required" widgets get their 46 // state set. 47 widget._hasBeenBlurred = true; 48 var valid = !widget.validate || widget.validate(); 49 if (!valid && !didFocus) { 50 // Set focus of the first non-valid widget 51 dijit.scrollIntoView(widget.containerNode||widget.domNode); 52 widget.focus(); 53 didFocus = true; 54 } 55 return valid; 56 }), "return item;"); 57 }, 58 36 59 setValues: function(/*object*/obj){ 37 60 // summary: fill in form values from a JSON structure 38 61