PDA

View Full Version : baseParams didn't pass the 0(int) in post form.



liangxingyuan
13 Aug 2009, 12:22 AM
I use the jsonstore.
And set the "jsonstore.baseParams[key] = 0;"
but it didn't really add the 0 to the baseParams as a value.
When posting, the post form look like: "key : (nothing here) ", it must be "key : 0".

Is it a bug?
And how can i take the 0 as a paramter?

Animal
13 Aug 2009, 1:03 AM
Use the strring "0"

liangxingyuan
13 Aug 2009, 6:24 PM
Is it the only way to solve this problem?
because the value is from the javascript in the runtime,
I don't know whether the value is string or int.

danh2000
13 Aug 2009, 7:26 PM
Is it the only way to solve this problem?
because the value is from the javascript in the runtime,
I don't know whether the value is string or int.

Does that matter? Why don't use just force it to be a string:


var somevar = 0;
somevar += '';
typeof somevar; //string

Animal
13 Aug 2009, 9:14 PM
This has been fixed in a later version. It was using a simple truth test on parameters.

When I use



Ext.urlEncode({foo:0});


at the Firebug command line it logs



foo=0