PDA

View Full Version : How to submit empty combo?



vicvolk87
20 May 2013, 8:12 PM
Hello, guys! I've just discovered that if my form contains a combobox, it is submitted only if I selected any value. If it is empty, I do not see its name among other posted fields. It is rather strange and it is not what I expected, bacause what I want in my case is to send a NULL value (it would be ok if I inserted something to my database, but if I edit and there is some value in a filed I need to update it with NULL). I guess it's a rather trivial question and hope someone will help me.

Farish
20 May 2013, 11:00 PM
I havent tried it but this might help you. When you call submit action of the form, use submitEmptyText. The doc says that its true by default though. Give it a try:

http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.form.action.Action-cfg-submitEmptyText

This will submit the emptyText of the combo. Based on this, you can know if the value was empty OR you can append the value to the url to which the form is submitted and read it out from there...

slemmon
20 May 2013, 11:07 PM
What version of ExtJS are you seeing that behavior in? < 4.2?

vicvolk87
20 May 2013, 11:13 PM
Farish: Thank you! But the problem is my combo has EmptyText value for informational purpose;
I use 4.1.1a.

slemmon
21 May 2013, 3:07 PM
The issue you're describing existed in versions < 4.2 as a bug, but hat been fixed in 4.2 so that an empty combo will send an empty string on form submit.