I want to hide elements of a form from users untill they click on a
radio button. Any pointers?
Thanks in advance - K
I want to hide elements of a form from users untill they click on a
radio button. Any pointers?
Thanks in advance - K
How you are generating the radio buttons?
radio_button_tag - since it is not associated with a model
On Jan 25, 12:27 pm, Mark D. [email protected]
Ok, can you just insert some javascript into the onclick method:
radio_button_tag ‘foo’, ‘foo’, false, :onclick =>
‘show_hide_appropriate_layer()’
This is what Ihave tried - still not working:
in .rhtml (a partial)
<%= radio_button_tag 'save',1, checked = false, options =
{:onclick => ‘show_hidden_div’} %>
Save To My Modules:
<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”;
}
}
}
<%= radio_button_tag ‘radios’, ‘one’, false,
:onclick => ‘toggle(this.value)’ %>
One
<%= radio_button_tag ‘radios’, ‘two’, false,
:onclick => ‘toggle(this.value)’ %>
Two
<%= radio_button_tag ‘radios’, ‘three’, false,
:onclick => ‘toggle(this.value)’ %>
Three
<%= radio_button_tag ‘radios’, ‘four’, false,
:onclick => ‘toggle(this.value)’ %>
Four
Yes … but what does the show_hide function look like? Thats were I am
having trouble.
Thanks -K
On Jan 25, 12:41 pm, Mark D. [email protected]
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs