PDA

View Full Version : [1.1-beta1/beta2/release1] Form.submit / method:'GET'



Thylia
4 Jul 2007, 8:48 AM
Hello,

I have a bug in this version, when I impose on the form method

tryanDLS
4 Jul 2007, 9:02 AM
Did you try debugging thru the Action.submit fn with Firebug? Are you correctly passing method:'GET' ?

Thylia
5 Jul 2007, 12:49 AM
My Code :


Demande.form = new Ext.form.Form({
labelAlign: 'left',
method: 'GET',
url:'Cgi.php?Cgi_Name=Set_Dti_Reg'
});

...

Demande.form.submit({
waitMsg:'En cours de d\'enregistrement de la demande...',
waitTitle:'Demande',
params: {

Cgi_Arg:Arg
},
success: function(form, action) {
var result = action.processResponse(action.response);
if(result === true || result.success){
Demande.refdti = result.RefDti;
// form.afterAction(action, true);
return;
}
if(result.errors){
form.markInvalid(result.errors);
action.failureType = Ext.form.Action.SERVER_INVALID;
}
form.afterAction(action, false);
}
});

Thylia
11 Jul 2007, 1:31 AM
Bump

mystix
11 Jul 2007, 1:41 AM
have you tried it with Ext 1.1. RC 1 (http://extjs.com/deploy/ext-1.1-rc1.zip)?

Thylia
11 Jul 2007, 2:12 AM
Yes I bug exist even with this version.
I have just made a simple test with the example of ExtJs \ Examples \ From \ Xml-Form.html


/*
* Ext JS Library 1.1 RC 1
* Copyright(c) 2006-2007, Ext JS, LLC.
* licensing@extjs.com
*
* http://www.extjs.com/license
*/

Ext.onReady(function(){

Ext.QuickTips.init();

// turn on validation errors beside the field globally
Ext.form.Field.prototype.msgTarget = 'side';

var fs = new Ext.form.Form({
labelAlign: 'right',
labelWidth: 75,
waitMsgTarget: 'box-bd',
method: 'GET',

// configure how to read the XML Data
reader : new Ext.data.XmlReader({
record : 'contact',
success: '@success'
}, [
{name: 'first', mapping:'name/first'}, // custom mapping
{name: 'last', mapping:'name/last'},
'company', 'email', 'state',
{name: 'dob', type:'date', dateFormat:'m/d/Y'} // custom data types
]),

// reusable eror reader class defined at the end of this file
errorReader: new Ext.form.XmlErrorReader()
});

fs.fieldset(
{legend:'Contact Information'},
new Ext.form.TextField({
fieldLabel: 'First Name',
name: 'first',
width:190
}),

new Ext.form.TextField({
fieldLabel: 'Last Name',
name: 'last',
width:190
}),

new Ext.form.TextField({
fieldLabel: 'Company',
name: 'company',
width:190
}),

new Ext.form.TextField({
fieldLabel: 'Email',
name: 'email',
vtype:'email',
width:190
}),

new Ext.form.ComboBox({
fieldLabel: 'State',
hiddenName:'state',
store: new Ext.data.SimpleStore({
fields: ['abbr', 'state'],
data : Ext.exampledata.states // from states.js
}),
valueField:'abbr',
displayField:'state',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a state...',
selectOnFocus:true,
width:190
}),

new Ext.form.DateField({
fieldLabel: 'Date of Birth',
name: 'dob',
width:190,
allowBlank:false
})
);

// simple button add
fs.addButton('Load', function(){
fs.load({url:'xml-form.xml', waitMsg:'Loading'});
});

// explicit add
var submit = fs.addButton({
text: 'Submit',
disabled:true,
handler: function(){
fs.submit({
url:'xml-errors.xml',
waitMsg:'Saving Data...'
});
}
});

fs.render('form-ct');

fs.on({
actioncomplete: function(form, action){
if(action.type == 'load'){
submit.enable();
}
}
});

});

// A reusable error reader class for XML forms
Ext.form.XmlErrorReader = function(){
Ext.form.XmlErrorReader.superclass.constructor.call(this, {
record : 'field',
success: '@success'
}, [
'id', 'msg'
]
);
};
Ext.extend(Ext.form.XmlErrorReader, Ext.data.XmlReader);

Result: it makes a POST whereas I put method GET

jay@moduscreate.com
11 Jul 2007, 7:36 AM
I confirmed this bug too.

mystix
11 Jul 2007, 10:50 AM
@thylia, i tried your example in 1.1 RC1 and i managed to get the correct results:

http://img172.imageshack.us/img172/7750/nobugps2.png


is there anything else i'm missing?

@djliquidice, did u use @thylia's test case too?

jay@moduscreate.com
11 Jul 2007, 11:10 AM
@djliquidice, did u use @thylia's test case too?

No, custom code.

I found the bug: http://extjs.com/forum/showthread.php?t=9112



inputForm = new Ext.form.Form({
labelAlign: 'right',
method: 'GET',
url: 'dnsmanager.php',
labelWidth: 80
});

jack.slocum
11 Jul 2007, 11:47 AM
This should be fixed in SVN.

jay@moduscreate.com
11 Jul 2007, 11:49 AM
@thylia, i tried your example in 1.1 RC1 and i managed to get the correct results:

http://img172.imageshack.us/img172/7750/nobugps2.png


is there anything else i'm missing?

@djliquidice, did u use @thylia's test case too?


I modified the example to reproduce the errors.
you can see the screen scrape videos here
http://www.tdg-i.com/extexamples/bug_screenshots/get_post_bug_using_example.wmv
http://www.tdg-i.com/extexamples/bug_screenshots/get_post_bug_custom_code.wmv

mystix
11 Jul 2007, 6:14 PM
@djliquidice, thanks for the videos. love the way you repeatedly highlight the method: 'GET' in the 1st video ;)
(you might want to check out Wink (http://www.debugmode.com/wink/) in future)

i guess u didn't manage to see jack's post since yours was merely 2 minutes after his. :)

could u try this with SVN revision 708 and let us know how that turns out?

jay@moduscreate.com
12 Jul 2007, 2:46 AM
@djliquidice, thanks for the videos. love the way you repeatedly highlight the method: 'GET' in the 1st video ;)
(you might want to check out Wink (http://www.debugmode.com/wink/) in future)

i guess u didn't manage to see jack's post since yours was merely 2 minutes after his. :)

could u try this with SVN revision 708 and let us know how that turns out?

no i didn't see that. i'm going to try it today. need to figure out how to get to SVN (it's in this forum, i know)

Thylia
12 Jul 2007, 4:21 AM
This should be fixed in SVN.

Ok

Thanks

jay@moduscreate.com
13 Jul 2007, 7:44 AM
Action.js, found the bug and applied the fix:


## Action.js
100 run : function(){
101 var o = this.options;
102 var isPost = this.getMethod() == 'POST';
103
104 if(o.clientValidation === false || this.form.isValid()){
105 Ext.Ajax.request(Ext.apply(this.createCallback(), {
106 form:this.form.el.dom,
107 url:this.getUrl(!isPost),
108 method: this.getMethod(), // <--- This is missing
109 params:isPost ? this.getParams() : null,
110 isUpload: this.form.fileUpload
111 }));
112
113 }else if (o.clientValidation !== false){ // client validation failed
114 this.failureType = Ext.form.Action.CLIENT_INVALID;
115 this.form.afterAction(this, false);
116 }
117 },

Test: http://tdg-i.com/extjs/examples/formBugFix/

http://tdg-i.com/extexamples/bug_screenshots/ext_get_post_bug_fixed