← Back to Upcase

Radio button form hassles


(Jon Seidel) #1

I’ve got what’s supposedly a simple form, with a string variable to identify which kind of image to use for a display. “1” means to use the company logo already uploaded and “2” means upload a different image. To collect the option, I’m using a radio button but the selection is ‘stuck’ on option “1”… either new records or existing records can only set the first option… clicking the second radio button immediately sets option one.

View code seems very straight-forward:

%fieldset  
  %label
    (*) Image for slide-show
    %br
    =f.radio_button :image_source, '1'
    Use the Company logo
    %br
    =f.radio_button :image_source, '2'
    Select a different image
    %br

And here’s the generated code:

<fieldset>
  <label>
    (*) Image for slide-show
    <br>
    <input id="featured_company_image_source_1" name="featured_company[image_source]" type="radio" value="1" />
    Use the Company logo
    <br>
    <input id="featured_company_image_source_2" name="featured_company[image_source]" type="radio" value="2" />
    Select a different image
    <br>
  </label>
</fieldset>

Gotta be something simple that I’m overlooking :=)

Updated Well, dang… now it works and I cannot figure out what changed along the line that made the difference. The only thing I can think of from reviewing the code is that there is no name="" field and there is on the latest code.

Resolved Strange but true: this is a bug in FireFox! The site displays correctly on Chrome for Linux & Windows, but FireFox for Linux and Windows both have this problem. Firefox also has problems handling some of the CSS on the site, again on both Linux and Windows while Chrome displays correctly. My testing on OSX also confirms this.