PDA

View Full Version : custom post params from form values



edmeehan
28 Sep 2010, 8:31 PM
So this is my first forum post here and I have been using EXTJS for about 3 weeks now... have been able to figure out most my issues thru searching or trail and error.

So what I want to do is capture user input values in a form and perform some basic functions with the values so I can post them in the format my server side developer wants them in. Also to not post the value of a checkbox field since I am only using it as a user action to expose more form inputs.


handler: function(){

sportFormPanel.getForm().findField('competitor') // disable this value
sportFormPanel.getForm().submit({
//params:{},
success: function(f,a){
Ext.Msg.alert('Success', 'It worked');
},
failure: function(f,a){
Ext.Msg.alert('Warning', 'You suck!');
}
});
}above is my handler function for the submit button... and this is what it post params look like.


Sport_ID=83365d9c-48db-4286-b0a7-37e354c8ab19
&Disciplines=
&ParticipationFrequency=Once+a+Year
&StartedParticipating=1234
&competitor=on
&CompeteFrequency=Once+a+Year
&StartedCompeting=1234
The param for competitor is not needed and I would like to remove it since it is just a check box to expose the CompeteFrequency & Started Competing fields.
Also I am using check boxes to select multiple values and need to change how this param value is returned. As of currently it looks like this


checkbox1=on
&checkbox2=on
&checkbox3=on
But I want to capture the values and build an array to pass such as this


checkbox=checkbox1,checkbox2,checkbox3
So... based on that information I am guessing that form.submit() is not the best method since it seems to just blast the form values and I want to make them custom. I was looking into the form.doAction() method but could not get it to work and have not been able to find any examples of it used with a form object. If any one could point me in the right direction I would greatly appreciate it. Sure this is a common thing, but can't seem to find anything on it.

Thanks in advance for any help.