Issue with empty strings and Flash Forms

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>

If you change the format to HTML, it works as expected.

Archived Comments

Comment 1 by Brett Liotta posted on 2/27/2005 at 9:03 AM

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.

Comment 2 by Nathan Dintenfass posted on 2/28/2005 at 1:02 AM

I sure hope MACR considers that to be a bug.

Comment 3 by barry.b posted on 2/28/2005 at 3:56 AM

&gt;&gt; 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

Comment 4 by Raymond Camden posted on 2/28/2005 at 4:58 AM

I forgot to add this to my blog post, but MACR is already aware of this and the bug is logged.

Comment 5 by Tony Bianco posted on 7/29/2005 at 7:40 AM

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

Comment 6 by Raymond Camden posted on 7/29/2005 at 7:46 AM

Can you show me your code? I have no problem seeing the value, and not the label, in my form posts.