Ext JS - Learning Center

Manual:Forms:BasicForm:standardSubmit

From Learn About the Ext JavaScript Library

Jump to: navigation, search

Ext Manual > Forms > BasicForm >

The standardSubmit property is a boolean (defaults to false) that causes a BasicForm to execute a standard browser submit action using the generated DOM object. When this option is used, the url and baseParams properties are ignored.

Examples

This example will send the form using a standard browser submit, to the url specified in the config, and parse the baseParams into hidden fields before sending.

Ext.onReady(function(){
   var F = new Ext.FormPanel({
      renderTo:document.body,
      labelAlign:"side",
      frame:true,
      autoHeight:true,
      waitMsgTarget:true,
      standardSubmit:true,
      baseParams:{id:1},
      url:"myProcess.php",
      title: "My Form",
      items: [
         {  title:"Name Fields",
            xtype:"fieldset",
            autoHeight:true,
            defaults:{hideLabel: true,labelSeparator: ""},
            items:{xtype:"textfield",name:"userName"}
         }],
      buttons: [
         {  text: "Save",
            handler: function() {
               var O=this.ownerCt;
               if(O.getForm().isValid()){
               if(O.url)O.getForm().getEl().dom.action=O.url;
               if(O.baseParams){
                  for(i in O.baseParams){ 
                     O.add(
                        {  xtype:"hidden",
                           name:i,
                           value:O.baseParams[i]
                        })
                  }
                  O.doLayout();
               }
               O.getForm().submit();
               }
            }
         }]
   })
});


Links

  • This page was last modified 19:56, 17 March 2008.
  • This page has been accessed 4,008 times.