Ext


Go Back   Ext JS Forums > Ext General Forums > Ext: Examples and Extras

Reply
 
Thread Tools
  #1  
Old 01-15-2008, 07:43 PM
Sierra Sierra is offline
Ext User
 
Join Date: Jan 2008
Posts: 3
Sierra is on a distinguished road
Lightbulb Normal submission of an Ext Form (FormPanel)

For all those people looking for a way to submit a FormPanel the old fashioned way in ExtJS 2.0


Ext.onReady(function(){

       
Ext.QuickTips.init();

    
// turn on validation errors beside the field globally
    
Ext.form.Field.prototype.msgTarget 'side';
    
    var 
login_form = new Ext.FormPanel({
        
        
idlogin_form,
        
labelWidth75
        
frame:true,
        
title'enterwhateveryouwant',
        
bodyStyle:'padding:5px 5px 0',
        
width350,
        
defaults: {width230},
        
onSubmitExt.emptyFn,
        
submit: function() {
                
this.getForm().getEl().dom.action 'enterthepageyouneed';
                
this.getForm().getEl().dom.submit();
                },
        
defaultType'textfield',

        
items: [{
                
fieldLabel'Email',
                
name'email',
                
vtype:'email',
                
allowBlank:false
            
},{
                
fieldLabel'Password',
                
inputType:'password',
                
name'password',
                
allowBlank:false 
            
},{
                
                
name'enterwhateveryouwant',
                   
inputType:'hidden',
                
value'enterwhateveryouwant'
              
            
}
        ],
buttons: [{
                
text'Login',
            
handlersubmitForm
            
}]
    });
    
   
    function 
submitForm(){
        
login_form.submit();
    }
    
        
login_form.render('login_form');

}); 

thanks to jg4smile who posted the "important parts" of this first
Reply With Quote
  #2  
Old 01-16-2008, 03:36 PM
SplitDestiny SplitDestiny is offline
Ext User
 
Join Date: Jan 2008
Posts: 1
SplitDestiny is on a distinguished road
Default

Thanks for this. I've been racking my brain over trying to figure out how to get a simple post request to work so I can integrate code I already have.
Reply With Quote
  #3  
Old 01-19-2008, 03:20 PM
boxorox boxorox is offline
Ext User
 
Join Date: Dec 2007
Posts: 5
boxorox is on a distinguished road
Default

Quote:
Originally Posted by SplitDestiny View Post
Thanks for this. I've been racking my brain over trying to figure out how to get a simple post request to work so I can integrate code I already have.

+1-bazillion!!!


I'm new to this and finally starting to wrap my brain around Ext! But i couldn't for the life of me figure out why setting the url property of the FormPanel wasn't translating to an action for my form. But this did the trick! thank you thank you thank you!

On thing I did was use the url property on FormPanel for my action. Makes it at a little more consistent with the default form handling.



submit: function() {
    
this.getForm().getEl().dom.action this.url;
    
this.getForm().getEl().dom.submit();

So the final question is... would it be possible to update the FormPanel documentation to include a note about setting the this.getForm().getEl().dom.action where it talks about enabling "normal browser submission"?

Thanks!
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 06:45 PM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.