Form Help

I want to hide elements of a form from users untill they click on a
radio button. Any pointers?

Thanks in advance - K

radio_button_tag - since it is not associated with a model

Yes .. but what does the show_hide function look like? Thats were I am
having trouble.

Thanks -K

This is what Ihave tried - still not working:

in .rhtml (a partial)

              <%= radio_button_tag 'save',1, checked = false, options =
{:onclick => 'show_hidden_div'} %>
              <label for="saved_name" >Save To My Modules:</label>

            <div id = "save_module", style="display:none;">
              <label for="saved_name" >Save As:</label>
              <%= text_field 'mod', 'saved_name' %>
            </div>

In application.js:

function show_hidden_div(){
  if (document.getElementById) {
   var save = form.save;
   if (save[0].checked) {
     document.getElementById("save_module").style.display = "block";
   }
  }
}

I got it to work - thanks :slight_smile: