So I noticed something odd today. I have a selectbox in a Flash Form that has a top level option doing this:
<option value="" <cfif form.donationForm is "">selected</cfif>>All</option>
However, when I submit the form, the value is "", not an empty string. Here is a more full featured example that shows it:
<cfdump var="#form#">
<cfform format="flash">
<cfselect name="foo">
<option value="">Blank</option>
<option value="1">One</option>
</cfselect>
<cfinput type="submit" name="f1" value="submit">
</cfform>
<cfform format="flash">
<cfselect name="foo">
<option value="">Blank</option>
<option value="1">One</option>
</cfselect>
<cfinput type="submit" name="f1" value="submit">
</cfform>
If you change the format to HTML, it works as expected.
Archived Comments
You have to use value=" " in the option tage, instead of value="". make sure there is one blank space in between the quotes. this works if you want cfform to submit a true blank string.
I sure hope MACR considers that to be a bug.
>> make sure there is one blank space in between the quotes. this works if you want cfform to submit a true blank string.
hang, on. that's not an empty string: that's data (a space) in it! not empty in my book...
the point is that the implimentation of cfform should be consistant to html forms.
yeah, I'd consider it a bug too!
my 2c
barry.b
I forgot to add this to my blog post, but MACR is already aware of this and the bug is logged.
I'm running into a wall myself and I'm getting tired of searching for the answer on the web. I have cfselect forms with <option> tags in them. When I go to submit the form and I use the #FORM.theSelectName# it gives me the what is displayed to the user and not what the value of the option is.
Any answers on this one? How do you grab the value.
- Tony
Can you show me your code? I have no problem seeing the value, and not the label, in my form posts.