- |
-
-
- errorReader : DataReader
- An Ext.data.DataReader (e.g. Ext.data.XmlReader) to be used to read field error messages returned from "submit" actio...
-
- An Ext.data.DataReader (e.g. Ext.data.XmlReader) to be used to read field error messages returned from "submit" actions. This is completely optional as there is built-in support for processing JSON. The Records which provide messages for the invalid Fields must use the Field name (or id) as the Record ID, and must contain a field called "msg" which contains the error message. The errorReader does not have to be a full-blown implementation of a DataReader. It simply needs to implement a read(xhr) function which returns an Array of Records in an object with the following structure: {
+retrieve parameter names and parameter values from the packet content.
Config Options|
| api : ObjectIf specified load and submit actions will be handled
+with Ext.form.Action.DirectLoad and Ext.form.Action.DirectSubmit... If specified load and submit actions will be handled
+with Ext.form.Action.DirectLoad and Ext.form.Action.DirectSubmit.
+Methods which have been imported by Ext.Direct can be specified here to load and submit
+forms.
+Such as the following: api: {
+ load: App.ss.MyProfile.load,
+ submit: App.ss.MyProfile.submit
+}
+ Load actions can use paramOrder or paramsAsHash
+to customize how the load method is invoked.
+Submit actions will always use a standard form submit. The formHandler configuration must
+be set on the associated server-side method which has been imported by Ext.Direct | BasicForm | | baseParams : ObjectParameters to pass with all requests. e.g. baseParams: {id: '123', foo: 'bar'}.
+Parameters are encoded as standard HT... Parameters to pass with all requests. e.g. baseParams: {id: '123', foo: 'bar'}.
+ Parameters are encoded as standard HTTP parameters using Ext.urlEncode. | BasicForm | | errorReader : DataReaderAn Ext.data.DataReader (e.g. Ext.data.XmlReader) to be used to
+read field error messages returned from 'submit' actio... An Ext.data.DataReader (e.g. Ext.data.XmlReader) to be used to
+read field error messages returned from 'submit' actions. This is optional
+as there is built-in support for processing JSON.
+ The Records which provide messages for the invalid Fields must use the
+Field name (or id) as the Record ID, and must contain a field called 'msg'
+which contains the error message.
+ The errorReader does not have to be a full-blown implementation of a
+DataReader. It simply needs to implement a read(xhr) function
+which returns an Array of Records in an object with the following
+structure: {
records: recordArray
-}
-
- |
- BasicForm |
-
-
- |
-
-
- fileUpload : Boolean
- Set to true if this form is a file upload. File uploads are not performed using normal "Ajax" techniques, that is the...
-
- Set to true if this form is a file upload. File uploads are not performed using normal "Ajax" techniques, that is they are not performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the DOM <form> element temporarily modified to have its target set to refer to a dynamically generated, hidden <iframe> which is inserted into the document but removed after the return data has been gathered. The server response is parsed by the browser to create the document for the IFRAME. If the server is using JSON to send the return object, then the Content-Type header must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body. Characters which are significant to an HTML parser must be sent as HTML entities, so encode "<" as "<", "&" as "&" etc. The response text is retrieved from the document, and a fake XMLHttpRequest object is created containing a responseText property in order to conform to the requirements of event handlers and callbacks. Be aware that file upload packets are sent with the content type multipart/form and some server technologies (notably JEE) may require some custom processing in order to retrieve parameter names and parameter values from the packet content.
-
- |
- BasicForm |
-
-
- |
-
-
- listeners : Object
- (optional) A config object containing one or more event handlers to be added to this object during initialization. Th...
-
- (optional) A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the addListener example for attaching multiple handlers at once.
-
- |
- Observable |
-
-
- |
-
-
- method : String
- The request method to use (GET or POST) for form actions if one isn't supplied in the action options.
- |
- BasicForm |
-
-
- |
-
-
- reader : DataReader
- An Ext.data.DataReader (e.g. Ext.data.XmlReader) to be used to read data when executing "load" actions. This is optio...
-
- An Ext.data.DataReader (e.g. Ext.data.XmlReader) to be used to read data when executing "load" actions. This is optional as there is built-in support for processing JSON.
-
- |
- BasicForm |
-
-
- |
-
-
- standardSubmit : Boolean
- If set to true, standard HTML form submits are used instead of XHR (Ajax) style form submissions. (defaults to false)...
-
- If set to true, standard HTML form submits are used instead of XHR (Ajax) style form submissions. (defaults to false) Note: When using standardSubmit, any the options to submit are ignored because Ext's Ajax infrastracture is bypassed. To pass extra parameters, you will need to create hidden fields within the form.
-
- |
- BasicForm |
-
-
- |
-
-
- timeout : Number
- Timeout for form actions in seconds (default is 30 seconds).
- |
- BasicForm |
-
-
- |
-
-
- trackResetOnLoad : Boolean
- If set to true, form.reset() resets to the last loaded or setValues() data instead of when the form was first created.
- |
- BasicForm |
-
-
- |
-
-
- url : String
- The URL to use for form actions if one isn't supplied in the action options.
- |
- BasicForm |
-
-
-
- Public Properties
-
-
-
-
-
-
- |
-
-
- waitMsgTarget : Mixed
-
-By default wait messages are displayed with Ext.MessageBox.wait. You can target a specific
-element by passing it or ...
-
-
-By default wait messages are displayed with Ext.MessageBox.wait. You can target a specific
-element by passing it or its id or mask the form itself by passing in true.
-
- |
- BasicForm |
-
-
-
- Public Methods
-
-
-
-
-
-
- |
-
-
- BasicForm( Mixed el , Object config )
-
-
-
- Parameters:
-
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- add( Field field1 , [Field field2 ], [Field etc ] ) : BasicForm
- Add Ext.form Components to this form's Collection. This does not result in rendering of
-the passed Component, it just...
-
- Add Ext.form Components to this form's Collection. This does not result in rendering of
+} | BasicForm | | fileUpload : BooleanSet to true if this form is a file upload.
+File uploads are not performed using normal 'Ajax' techniques, that is the... Set to true if this form is a file upload.
+ File uploads are not performed using normal 'Ajax' techniques, that is they are not
+performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the
+DOM <form> element temporarily modified to have its
+target set to refer
+to a dynamically generated, hidden <iframe> which is inserted into the document
+but removed after the return data has been gathered.
+ The server response is parsed by the browser to create the document for the IFRAME. If the
+server is using JSON to send the return object, then the
+Content-Type header
+must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.
+ Characters which are significant to an HTML parser must be sent as HTML entities, so encode
+"<" as "<", "&" as "&" etc.
+ The response text is retrieved from the document, and a fake XMLHttpRequest object
+is created containing a responseText property in order to conform to the
+requirements of event handlers and callbacks.
+ Be aware that file upload packets are sent with the content type multipart/form
+and some server technologies (notably JEE) may require some custom processing in order to
+retrieve parameter names and parameter values from the packet content. | BasicForm | | listeners : ObjectA config object containing one or more event handlers to be added to this
+object during initialization. This should ... A config object containing one or more event handlers to be added to this
+object during initialization. This should be a valid listeners config object as specified in the
+addListener example for attaching multiple handlers at once.
+ DOM events from ExtJs Components
+ While some ExtJs Component classes export selected DOM events (e.g. "click", "mouseover" etc), this
+is usually only done when extra value can be added. For example the DataView's
+click event passing the node clicked on. To access DOM
+events directly from a Component's HTMLElement, listeners must be added to the Element after the Component
+has been rendered. A plugin can simplify this step: // Plugin is configured with a listeners config object.
+// The Component is appended to the argument list of all handler functions.
+Ext.DomObserver = Ext.extend(Object, {
+ constructor: function(config) {
+ this.listeners = config.listeners ? config.listeners : config;
+ },
+
+ // Component passes itself into plugin's init method
+ init: function(c) {
+ var p, l = this.listeners;
+ for (p in l) {
+ if (Ext.isFunction(l[p])) {
+ l[p] = this.createHandler(l[p], c);
+ } else {
+ l[p].fn = this.createHandler(l[p].fn, c);
+ }
+ }
+
+ // Add the listeners to the Element immediately following the render call
+ c.render = c.render.createSequence(function() {
+ var e = c.getEl();
+ if (e) {
+ e.on(l);
+ }
+ });
+ },
+
+ createHandler: function(fn, c) {
+ return function(e) {
+ fn.call(this, e, c);
+ };
+ }
+});
+
+var combo = new Ext.form.ComboBox({
+
+ // Collapse combo when its element is clicked on
+ plugins: [ new Ext.DomObserver({
+ click: function(evt, comp) {
+ comp.collapse();
+ }
+ })],
+ store: myStore,
+ typeAhead: true,
+ mode: 'local',
+ triggerAction: 'all'
+});
| Observable | | method : String The request method to use (GET or POST) for form actions if one isn't supplied in the action options. | BasicForm | | paramOrder : Array/StringA list of params to be executed server side.
+Defaults to undefined. Only used for the api
+load configuration.
+Specify... A list of params to be executed server side.
+Defaults to undefined. Only used for the api
+load configuration.
+ Specify the params in the order in which they must be executed on the
+server-side as either (1) an Array of String values, or (2) a String of params
+delimited by either whitespace, comma, or pipe. For example,
+any of the following would be acceptable: paramOrder: ['param1','param2','param3']
+paramOrder: 'param1 param2 param3'
+paramOrder: 'param1,param2,param3'
+paramOrder: 'param1|param2|param'
| BasicForm | | paramsAsHash : BooleanOnly used for the api
+load configuration. Send parameters as a collection of named
+arguments (defaults to false). Pro... Only used for the api
+ load configuration. Send parameters as a collection of named
+arguments (defaults to false). Providing a
+ paramOrder nullifies this configuration. | BasicForm | | reader : DataReaderAn Ext.data.DataReader (e.g. Ext.data.XmlReader) to be used to read
+data when executing 'load' actions. This is optio... An Ext.data.DataReader (e.g. Ext.data.XmlReader) to be used to read
+data when executing 'load' actions. This is optional as there is built-in
+support for processing JSON. For additional information on using an XMLReader
+see the example provided in examples/form/xml-form.html. | BasicForm | | standardSubmit : BooleanIf set to true, standard HTML form submits are used instead
+of XHR (Ajax) style form submissions. Defaults to false.
+... If set to true, standard HTML form submits are used instead
+of XHR (Ajax) style form submissions. Defaults to false.
+ Note: When using standardSubmit , the
+options to submit are ignored because
+Ext's Ajax infrastracture is bypassed. To pass extra parameters (e.g.
+baseParams and params ), utilize hidden fields
+to submit extra data, for example:
+ new Ext.FormPanel({
+ standardSubmit: true,
+ baseParams: {
+ foo: 'bar'
+ },
+ url: 'myProcess.php',
+ items: [{
+ xtype: 'textfield',
+ name: 'userName'
+ }],
+ buttons: [{
+ text: 'Save',
+ handler: function(){
+ var fp = this.ownerCt.ownerCt,
+ form = fp.getForm();
+ if (form.isValid()) {
+ // check if there are baseParams and if
+ // hiddent items have been added already
+ if (fp.baseParams && !fp.paramsAdded) {
+ // add hidden items for all baseParams
+ for (i in fp.baseParams) {
+ fp.add({
+ xtype: 'hidden',
+ name: i,
+ value: fp.baseParams[i]
+ });
+ }
+ fp.doLayout();
+ // set a custom flag to prevent re-adding
+ fp.paramsAdded = true;
+ }
+ form.submit();
+ }
+ }
+ }]
+});
| BasicForm | | timeout : Number Timeout for form actions in seconds (default is 30 seconds). | BasicForm | | trackResetOnLoad : BooleanIf set to true, reset() resets to the last loaded
+or setValues() data instead of when the form was first created. De... If set to true, reset() resets to the last loaded
+or setValues() data instead of when the form was first created. Defaults to false. | BasicForm | | url : StringThe URL to use for form actions if one isn't supplied in the
+ doAction options . | BasicForm | | waitTitle : String The default title to show for the waiting message box (defaults to 'Please Wait...') | BasicForm | Public Properties|
| items : MixedCollection | BasicForm | | waitMsgTarget : MixedBy default wait messages are displayed with Ext.MessageBox.wait. You can target a specific
+element by passing it or i... By default wait messages are displayed with Ext.MessageBox.wait. You can target a specific
+element by passing it or its id or mask the form itself by passing in true. | BasicForm |
Public Methods|
| BasicForm( Mixed el , Object config )
+ | BasicForm | | add( Field field1 , [Field field2 ], [Field etc ] )
+ :
+ BasicFormAdd Ext.form Components to this form's Collection. This does not result in rendering of
+the passed Component, it just... Add Ext.form Components to this form's Collection. This does not result in rendering of
the passed Component, it just enables the form to validate Fields, and distribute values to
Fields.
You will not usually call this function. In order to be rendered, a Field must be added
-to a Container, usually an FormPanel.
+to a Container, usually an FormPanel.
The FormPanel to which the field is added takes care of adding the Field to the BasicForm's
-collection.
- Parameters:
- field1 : Fieldfield2 : Field(optional) etc : Field(optional)
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- addEvents( Object object ) : void
- Used to define events on this Observable
-
- Used to define events on this Observable
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- addListener( String eventName , Function handler , [Object scope ], [Object options ] ) : void
- Appends an event handler to this component
-
- Appends an event handler to this component
- Parameters:
- eventName : StringThe type of event to listen for handler : FunctionThe method the event invokes scope : Object(optional) The scope in which to execute the handler
-function. The handler function's "this" context. options : Object(optional) An object containing handler configuration
+collection. Parameters:field1 : Fieldfield2 : Field(optional) etc : Field(optional) Returns:
| BasicForm | | addEvents( Object|String o , string Optional. )
+ :
+ voidAdds the specified events to the list of events which this Observable may fire. Adds the specified events to the list of events which this Observable may fire. | Observable | | addListener( String eventName , Function handler , [Object scope ], [Object options ] )
+ :
+ voidAppends an event handler to this object. Appends an event handler to this object. Parameters:eventName : StringThe name of the event to listen for. handler : FunctionThe method the event invokes. scope : Object(optional) The scope (this reference) in which the handler function is executed.
+If omitted, defaults to the object which fired the event. options : Object(optional) An object containing handler configuration.
properties. This may contain any of the following properties:
-- scope : Object
The scope in which to execute the handler function. The handler function's "this" context.
-- delay : Number
The number of milliseconds to delay the invocation of the handler after the event fires.
-- single : Boolean
True to add a handler to handle just the next firing of the event, and then remove itself.
-- buffer : Number
Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed
+ - scope : Object
The scope (this reference) in which the handler function is executed.
+If omitted, defaults to the object which fired the event.
+- delay : Number
The number of milliseconds to delay the invocation of the handler after the event fires.
+- single : Boolean
True to add a handler to handle just the next firing of the event, and then remove itself.
+- buffer : Number
Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed
by the specified number of milliseconds. If the event fires again within that time, the original
-handler is not invoked, but the new handler is scheduled in its place.
+handler is not invoked, but the new handler is scheduled in its place.
+- target : Observable
Only call the handler if the event was fired on the target Observable, not
+if the event was bubbled up from a child Observable.
Combining Options
Using the options argument, it is possible to combine different types of listeners:
-A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)
- el.on('click', this.onClick, this, {
- single: true,
- delay: 100,
- forumId: 4
+A delayed, one-time listener.
+myDataView.on('click', this.onClick, this, {
+single: true,
+delay: 100
});
Attaching multiple handlers in 1 call
The method also allows for a single argument to be passed which is a config object containing properties
which specify multiple handlers.
- foo.on({
- 'click' : {
- fn: this.onClick,
- scope: this,
- delay: 100
- },
- 'mouseover' : {
- fn: this.onMouseOver,
- scope: this
- },
- 'mouseout' : {
- fn: this.onMouseOut,
- scope: this
- }
+myGridPanel.on({
+'click' : {
+ fn: this.onClick,
+ scope: this,
+ delay: 100
+},
+'mouseover' : {
+ fn: this.onMouseOver,
+ scope: this
+},
+'mouseout' : {
+ fn: this.onMouseOut,
+ scope: this
+}
});
Or a shorthand syntax:
- foo.on({
- 'click' : this.onClick,
- 'mouseover' : this.onMouseOver,
- 'mouseout' : this.onMouseOut,
- scope: this
-});
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- applyIfToFields( Object values ) : BasicForm
- Calls Ext.applyIf for all field in this form with the passed object.
-
- Calls Ext.applyIf for all field in this form with the passed object.
- Parameters:
-
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- applyToFields( Object values ) : BasicForm
- Calls Ext.apply for all fields in this form with the passed object.
-
- Calls Ext.apply for all fields in this form with the passed object.
- Parameters:
-
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- clearInvalid() : BasicForm
- Clears all invalid messages in this form.
-
- Clears all invalid messages in this form.
- Parameters:
-
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- doAction( String/Object actionName , [Object options ] ) : BasicForm
- Performs a predefined action (Ext.form.Action.Submit or
-Ext.form.Action.Load) or a custom extension of Ext.form.Actio...
-
- Performs a predefined action ( Ext.form.Action.Submit or
- Ext.form.Action.Load) or a custom extension of Ext.form.Action
-to perform application-specific processing.
- Parameters:
- actionName : String/ObjectThe name of the predefined action type,
-or instance of Ext.form.Action to perform. options : Object(optional) The options to pass to the Ext.form.Action.
-All of the config options listed below are supported by both the submit
-and load actions unless otherwise noted (custom actions could also accept
+ myGridPanel.on({
+'click' : this.onClick,
+'mouseover' : this.onMouseOver,
+'mouseout' : this.onMouseOut,
+ scope: this
+});
Returns: | Observable | | applyIfToFields( Object values )
+ :
+ BasicFormCalls Ext.applyIf for all field in this form with the passed object. Calls Ext.applyIf for all field in this form with the passed object. | BasicForm | | applyToFields( Object values )
+ :
+ BasicFormCalls Ext.apply for all fields in this form with the passed object. Calls Ext.apply for all fields in this form with the passed object. | BasicForm | | clearInvalid()
+ :
+ BasicFormClears all invalid messages in this form. Clears all invalid messages in this form. | BasicForm | | doAction( String/Object actionName , [Object options ] )
+ :
+ BasicFormPerforms a predefined action (Ext.form.Action.Submit or
+Ext.form.Action.Load) or a custom extension of Ext.form.Actio... Performs a predefined action ( Ext.form.Action.Submit or
+ Ext.form.Action.Load) or a custom extension of Ext.form.Action
+to perform application-specific processing. Parameters:actionName : String/ObjectThe name of the predefined action type,
+or instance of Ext.form.Action to perform. options : Object(optional) The options to pass to the Ext.form.Action.
+All of the config options listed below are supported by both the
+ submit and load
+actions unless otherwise noted (custom actions could also accept
other config options):
-- url : String
The url for the action (defaults
-to the form's url.)
-- method : String
The form method to use (defaults
-to the form's method, or POST if not defined)
-- params : String/Object
The params to pass
-(defaults to the form's baseParams, or none if not defined)
-- headers : Object
Request headers to set for the action
-(defaults to the form's default headers)
-- success : Function
The callback that will
-be invoked after a successful response. The function is passed the following parameters:
-- failure : Function
The callback that will
-be invoked after a failed transaction attempt. The function
-is passed the following parameters:
-- scope : Object
The scope in which to call the
-callback functions (The this reference for the callback functions).
-- clientValidation : Boolean
Submit Action only.
+ - url : String
The url for the action (defaults
+to the form's url.)
+- method : String
The form method to use (defaults
+to the form's method, or POST if not defined)
+- params : String/Object
The params to pass
+(defaults to the form's baseParams, or none if not defined)
+ Parameters are encoded as standard HTTP parameters using Ext.urlEncode.
+- headers : Object
Request headers to set for the action
+(defaults to the form's default headers)
+- success : Function
The callback that will
+be invoked after a successful response (see top of
+ submit and load
+for a description of what constitutes a successful response).
+The function is passed the following parameters:
+- failure : Function
The callback that will be invoked after a
+failed transaction attempt. The function is passed the following parameters:
+- form : The Ext.form.BasicForm that requested the action.
+- action : The Action object which performed the operation.
+
The action object contains these properties of interest:
+- scope : Object
The scope in which to call the
+callback functions (The this reference for the callback functions).
+- clientValidation : Boolean
Submit Action only.
Determines whether a Form's fields are validated in a final call to
- isValid prior to submission. Set to false
-to prevent this. If undefined, pre-submission field validation is performed.
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- findField( String id ) : Field
- Find a Ext.form.Field in this form by id, dataIndex, name or hiddenName.
-
- Find a Ext.form.Field in this form by id, dataIndex, name or hiddenName.
- Parameters:
- id : StringThe value to search for
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- fireEvent( String eventName , Object... args ) : Boolean
- Fires the specified event with the passed parameters (minus the event name).
-
- Fires the specified event with the passed parameters (minus the event name).
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- getEl() : Ext.Element
- Get the HTML form Element
-
- Get the HTML form Element
- Parameters:
-
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- getValues( [Boolean asString ] ) : String/Object
- Returns the fields in this form as an object with key/value pairs as they would be submitted using a standard form su...
-
- Returns the fields in this form as an object with key/value pairs as they would be submitted using a standard form submit.
+isValid prior to submission. Set to false
+to prevent this. If undefined, pre-submission field validation is performed. Returns: | BasicForm | | enableBubble( String/Array events )
+ :
+ voidEnables events fired by this Observable to bubble up an owner hierarchy by calling
+this.getBubbleTarget() if present.... Enables events fired by this Observable to bubble up an owner hierarchy by calling
+this.getBubbleTarget() if present. There is no implementation in the Observable base class.
+ This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component.getBubbleTarget. The default
+implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to
+access the required target more quickly.
+ Example: Ext.override(Ext.form.Field, {
+ // Add functionality to Field's initComponent to enable the change event to bubble
+ initComponent : Ext.form.Field.prototype.initComponent.createSequence(function() {
+ this.enableBubble('change');
+ }),
+
+ // We know that we want Field's events to bubble directly to the FormPanel.
+ getBubbleTarget : function() {
+ if (!this.formPanel) {
+ this.formPanel = this.findParentByType('form');
+ }
+ return this.formPanel;
+ }
+});
+
+var myForm = new Ext.formPanel({
+ title: 'User Details',
+ items: [{
+ ...
+ }],
+ listeners: {
+ change: function() {
+ // Title goes red if form has been modified.
+ myForm.header.setStyle('color', 'red');
+ }
+ }
+});
| Observable | | findField( String id )
+ :
+ FieldFind a Ext.form.Field in this form. | BasicForm | | fireEvent( String eventName , Object... args )
+ :
+ BooleanFires the specified event with the passed parameters (minus the event name).
+An event may be set to bubble up an Obse... | Observable | | getEl()
+ :
+ Ext.ElementGet the HTML form Element Get the HTML form Element | BasicForm | | getFieldValues( [Boolean dirtyOnly ] )
+ :
+ ObjectRetrieves the fields in the form as a set of key/value pairs, using the getValue() method.
+If multiple fields exist w... Retrieves the fields in the form as a set of key/value pairs, using the getValue() method.
+If multiple fields exist with the same name they are returned as an array. Parameters:Returns:Object The values in the form
| BasicForm | | getValues( [Boolean asString ] )
+ :
+ String/ObjectReturns the fields in this form as an object with key/value pairs as they would be submitted using a standard form su... Returns the fields in this form as an object with key/value pairs as they would be submitted using a standard form submit.
If multiple fields exist with the same name they are returned as an array.
Note: The values are collected from all enabled HTML input elements within the form, not from
-the Ext Field objects. This means that all returned values are Strings (or Arrays of Strings) and that the the
-value can potentionally be the emptyText of a field.
- Parameters:
-
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- hasListener( String eventName ) : Boolean
- Checks to see if this object has any listeners for a specified event
-
- Checks to see if this object has any listeners for a specified event
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- isDirty() : Boolean
- Returns true if any fields in this form have changed since their original load.
-
- Returns true if any fields in this form have changed since their original load.
- Parameters:
-
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- isValid() : Boolean
- Returns true if client-side validation on the form is successful.
-
- Returns true if client-side validation on the form is successful.
- Parameters:
-
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- load( Object options ) : BasicForm
- Shortcut to do a load action.
-
- Shortcut to do a load action.
- Parameters:
- options : ObjectThe options to pass to the action (see doAction for details)
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- loadRecord( Record record ) : BasicForm
- Loads an Ext.data.Record into this form.
-
- Loads an Ext.data.Record into this form.
- Parameters:
- record : RecordThe record to load
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- markInvalid( Array/Object errors ) : BasicForm
- Mark fields in this form invalid in bulk.
-
- Mark fields in this form invalid in bulk.
- Parameters:
- errors : Array/ObjectEither an array in the form [{id:'fieldId', msg:'The message'},...] or an object hash of {id: msg, id2: msg2}
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- on( String eventName , Function handler , [Object scope ], [Object options ] ) : void
- Appends an event handler to this element (shorthand for addListener)
-
- Appends an event handler to this element (shorthand for addListener)
- Parameters:
- eventName : StringThe type of event to listen for handler : FunctionThe method the event invokes scope : Object(optional) The scope in which to execute the handler
-function. The handler function's "this" context. options : Object(optional)
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- purgeListeners() : void
- Removes all listeners for this object
-
- Removes all listeners for this object
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- relayEvents( Object o , Array events ) : void
- Relays selected events from the specified Observable as if the events were fired by this.
-
- Relays selected events from the specified Observable as if the events were fired by this.
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- remove( Field field ) : BasicForm
- Removes a field from the items collection (does NOT remove its markup).
-
- Removes a field from the items collection (does NOT remove its markup).
- Parameters:
-
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- removeListener( String eventName , Function handler , [Object scope ] ) : void
- Removes a listener
-
- Removes a listener
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- render() : BasicForm
- Iterates through the Fields which have been added to this BasicForm,
-checks them for an id attribute, and calls Ext.f...
-
- Iterates through the Fields which have been added to this BasicForm,
-checks them for an id attribute, and calls Ext.form.Field.applyToMarkup on the existing dom element with that id.
- Parameters:
-
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- reset() : BasicForm
- Resets this form.
-
- Resets this form.
- Parameters:
-
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- resumeEvents() : void
-
-
- Resume firing events. (see suspendEvents)
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- setValues( Array/Object values ) : BasicForm
- Set values for fields in this form in bulk.
-
- Set values for fields in this form in bulk.
- Parameters:
- values : Array/ObjectEither an array in the form: [{id:'clientName', value:'Fred. Olsen Lines'},
- {id:'portOfLoading', value:'FXT'},
- {id:'portOfDischarge', value:'OSL'} ]
-or an object hash of the form: {
- clientName: 'Fred. Olsen Lines',
- portOfLoading: 'FXT',
- portOfDischarge: 'OSL'
-}
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- submit( Object options ) : BasicForm
- Shortcut to do a submit action.
-
- Shortcut to do a submit action.
- Parameters:
- options : ObjectThe options to pass to the action (see doAction for details).
- Note: this is ignored when using the standardSubmit option.
+the Ext Field objects. This means that all returned values are Strings (or Arrays of Strings) and that the
+value can potentially be the emptyText of a field.
| BasicForm | | hasListener( String eventName )
+ :
+ BooleanChecks to see if this object has any listeners for a specified event Checks to see if this object has any listeners for a specified event | Observable | | isDirty()
+ :
+ BooleanReturns true if any fields in this form have changed from their original values.
+Note that if this BasicForm was conf... Returns true if any fields in this form have changed from their original values.
+ Note that if this BasicForm was configured with trackResetOnLoad then the
+Fields' original values are updated when the values are loaded by setValues
+or loadRecord. | BasicForm | | isValid()
+ :
+ BooleanReturns true if client-side validation on the form is successful. Returns true if client-side validation on the form is successful. | BasicForm | | load( Object options )
+ :
+ BasicFormShortcut to do a load action. Shortcut to do a load action. Parameters:options : ObjectThe options to pass to the action (see doAction for details) Returns: | BasicForm | | loadRecord( Record record )
+ :
+ BasicFormLoads an Ext.data.Record into this form by calling setValues with the
+record data.
+See also trackResetOnLoad. | BasicForm | | markInvalid( Array/Object errors )
+ :
+ BasicFormMark fields in this form invalid in bulk. Mark fields in this form invalid in bulk. Parameters:errors : Array/ObjectEither an array in the form [{id:'fieldId', msg:'The message'},...] or an object hash of {id: msg, id2: msg2} Returns: | BasicForm | | on( String eventName , Function handler , [Object scope ], [Object options ] )
+ :
+ voidAppends an event handler to this object (shorthand for addListener.) Appends an event handler to this object (shorthand for addListener.) Parameters:eventName : StringThe type of event to listen for handler : FunctionThe method the event invokes scope : Object(optional) The scope (this reference) in which the handler function is executed.
+If omitted, defaults to the object which fired the event. options : Object(optional) An object containing handler configuration. Returns: | Observable | | purgeListeners()
+ :
+ voidRemoves all listeners for this object Removes all listeners for this object | Observable | | relayEvents( Object o , Array events )
+ :
+ voidRelays selected events from the specified Observable as if the events were fired by this. Relays selected events from the specified Observable as if the events were fired by this. | Observable | | remove( Field field )
+ :
+ BasicFormRemoves a field from the items collection (does NOT remove its markup). Removes a field from the items collection (does NOT remove its markup). | BasicForm | | removeListener( String eventName , Function handler , [Object scope ] )
+ :
+ voidRemoves an event handler. Removes an event handler. | Observable | | render()
+ :
+ BasicFormIterates through the Fields which have been added to this BasicForm,
+checks them for an id attribute, and calls Ext.f... Iterates through the Fields which have been added to this BasicForm,
+checks them for an id attribute, and calls Ext.form.Field.applyToMarkup on the existing dom element with that id. | BasicForm | | reset()
+ :
+ BasicForm | BasicForm | | resumeEvents()
+ :
+ voidResume firing events. (see suspendEvents)
+If events were suspended using the queueSuspended parameter, then all
+event... Resume firing events. (see suspendEvents)
+If events were suspended using the queueSuspended parameter, then all
+events fired during event suspension will be sent to any listeners now. | Observable | | setValues( Array/Object values )
+ :
+ BasicFormSet values for fields in this form in bulk. Set values for fields in this form in bulk. Parameters:values : Array/ObjectEither an array in the form: [{id:'clientName', value:'Fred. Olsen Lines'},
+ {id:'portOfLoading', value:'FXT'},
+ {id:'portOfDischarge', value:'OSL'} ]
+or an object hash of the form: {
+ clientName: 'Fred. Olsen Lines',
+ portOfLoading: 'FXT',
+ portOfDischarge: 'OSL'
+}
Returns: | BasicForm | | submit( Object options )
+ :
+ BasicFormShortcut to do a submit action. Shortcut to do a submit action. Parameters:options : ObjectThe options to pass to the action (see doAction for details).
+ Note: this is ignored when using the standardSubmit option.
The following code: myFormPanel.getForm().submit({
clientValidation: true,
url: 'updateConsignment.php',
@@ -849,155 +425,39 @@ or an object hash of the form:
{
newStatus: 'delivered'
},
success: function(form, action) {
- Ext.Msg.alert("Success", action.result.msg);
+ Ext.Msg.alert('Success', action.result.msg);
},
failure: function(form, action) {
switch (action.failureType) {
case Ext.form.Action.CLIENT_INVALID:
- Ext.Msg.alert("Failure", "Form fields may not be submitted with invalid values");
+ Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values');
break;
case Ext.form.Action.CONNECT_FAILURE:
- Ext.Msg.alert("Failure", "Ajax communication failed");
+ Ext.Msg.alert('Failure', 'Ajax communication failed');
break;
case Ext.form.Action.SERVER_INVALID:
- Ext.Msg.alert("Failure", action.result.msg);
+ Ext.Msg.alert('Failure', action.result.msg);
}
}
});
would process the following server response for a successful submission: {
- success: true,
- msg: 'Consignment updated'
+ "success":true, // note this is Boolean, not string
+ "msg":"Consignment updated"
}
and the following server response for a failed submission: {
- success: false,
- msg: 'You do not have permission to perform this operation'
-}
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- suspendEvents() : void
-
-
- Suspend the firing of all events. (see resumeEvents)
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- un( String eventName , Function handler , [Object scope ] ) : void
- Removes a listener (shorthand for removeListener)
-
- Removes a listener (shorthand for removeListener)
- Parameters:
-
- Returns:
-
-
-
-
- |
- Observable |
-
-
- |
-
-
- updateRecord( Record record ) : BasicForm
- Persists the values in this form into the passed Ext.data.Record object in a beginEdit/endEdit block.
-
- Persists the values in this form into the passed Ext.data.Record object in a beginEdit/endEdit block.
- Parameters:
- record : RecordThe record to edit
- Returns:
-
-
-
-
- |
- BasicForm |
-
-
-
- Public Events
-
-
-
-
-
-
- |
-
-
- actioncomplete : ( Form this , Action action )
- Fires when an action is completed.
-
- Fires when an action is completed.
- Listeners will be called with the following arguments:
- this : Formaction : Action
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- actionfailed : ( Form this , Action action )
- Fires when an action fails.
-
- Fires when an action fails.
- Listeners will be called with the following arguments:
- this : Formaction : Action
-
-
-
- |
- BasicForm |
-
-
- |
-
-
- beforeaction : ( Form this , Action action )
- Fires before any action is performed. Return false to cancel the action.
-
- Fires before any action is performed. Return false to cancel the action.
- Listeners will be called with the following arguments:
- this : Formaction : Action
-
-
-
- |
- BasicForm |
-
-
-
-
\ No newline at end of file
+ "success":false, // note this is Boolean, not string
+ "msg":"You do not have permission to perform this operation"
+}Returns: | BasicForm |