root / trunk / web / dojo / dijit / form / Form.js
History | View | Annotate | Download (2.22 KB)
| 1 |
/*
|
|---|---|
| 2 |
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
| 3 |
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
| 4 |
see: http://dojotoolkit.org/license for details
|
| 5 |
*/
|
| 6 |
|
| 7 |
|
| 8 |
if(!dojo._hasResource["dijit.form.Form"]){ |
| 9 |
dojo._hasResource["dijit.form.Form"]=true; |
| 10 |
dojo.provide("dijit.form.Form");
|
| 11 |
dojo.require("dijit._Widget");
|
| 12 |
dojo.require("dijit._Templated");
|
| 13 |
dojo.require("dijit.form._FormMixin");
|
| 14 |
dojo.declare("dijit.form.Form",[dijit._Widget,dijit._Templated,dijit.form._FormMixin],{name:"",action:"",method:"",encType:"","accept-charset":"",accept:"",target:"",templateString:"<form dojoAttachPoint='containerNode' dojoAttachEvent='onreset:_onReset,onsubmit:_onSubmit' ${!nameAttrSetting}></form>",attributeMap:dojo.delegate(dijit._Widget.prototype.attributeMap,{action:"",method:"",encType:"","accept-charset":"",accept:"",target:""}),postMixInProperties:function(){ |
| 15 |
this.nameAttrSetting=this.name?("name='"+this.name+"'"):""; |
| 16 |
this.inherited(arguments); |
| 17 |
},execute:function(_1){ |
| 18 |
},onExecute:function(){ |
| 19 |
},_setEncTypeAttr:function(_2){ |
| 20 |
this.encType=_2;
|
| 21 |
dojo.attr(this.domNode,"encType",_2); |
| 22 |
if(dojo.isIE){
|
| 23 |
this.domNode.encoding=_2;
|
| 24 |
} |
| 25 |
},postCreate:function(){ |
| 26 |
if(dojo.isIE&&this.srcNodeRef&&this.srcNodeRef.attributes){ |
| 27 |
var _3=this.srcNodeRef.attributes.getNamedItem("encType"); |
| 28 |
if(_3&&!_3.specified&&(typeof _3.value=="string")){ |
| 29 |
this.set("encType",_3.value); |
| 30 |
} |
| 31 |
} |
| 32 |
this.inherited(arguments); |
| 33 |
},reset:function(e){ |
| 34 |
var _4={returnValue:true,preventDefault:function(){ |
| 35 |
this.returnValue=false; |
| 36 |
},stopPropagation:function(){ |
| 37 |
},currentTarget:e?e.target:this.domNode,target:e?e.target:this.domNode}; |
| 38 |
if(!(this.onReset(_4)===false)&&_4.returnValue){ |
| 39 |
this.inherited(arguments,[]); |
| 40 |
} |
| 41 |
},onReset:function(e){ |
| 42 |
return true; |
| 43 |
},_onReset:function(e){ |
| 44 |
this.reset(e);
|
| 45 |
dojo.stopEvent(e); |
| 46 |
return false; |
| 47 |
},_onSubmit:function(e){ |
| 48 |
var fp=dijit.form.Form.prototype;
|
| 49 |
if(this.execute!=fp.execute||this.onExecute!=fp.onExecute){ |
| 50 |
dojo.deprecated("dijit.form.Form:execute()/onExecute() are deprecated. Use onSubmit() instead.","","2.0"); |
| 51 |
this.onExecute();
|
| 52 |
this.execute(this.getValues()); |
| 53 |
} |
| 54 |
if(this.onSubmit(e)===false){ |
| 55 |
dojo.stopEvent(e); |
| 56 |
} |
| 57 |
},onSubmit:function(e){ |
| 58 |
return this.isValid(); |
| 59 |
},submit:function(){ |
| 60 |
if(!(this.onSubmit()===false)){ |
| 61 |
this.containerNode.submit();
|
| 62 |
} |
| 63 |
}}); |
| 64 |
} |