[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby check_boxes select/unselect all problem

sig_UVA

4/25/2006 5:28:00 AM

I have the three erb check_boxes below:

Patient #1<%= check_box("patient", '1', {}, "yes","no") %></br>
Patient #2<%= check_box("patient", '2', {}, "yes","no") %></br>
Patient #4<%= check_box("patient", '4', {}, "yes","no") %></br>


The HTML output looks like this:

Patient #1<input id="patient_1" name="patient[1]" type="checkbox"
value="yes" /><input name="patient[1]" type="hidden" value="no" /></br>

Patient #2<input id="patient_2" name="patient[2]" type="checkbox"
value="yes" /><input name="patient[2]" type="hidden" value="no" /></br>

Patient #4<input id="patient_4" name="patient[4]" type="checkbox"
value="yes" /><input name="patient[4]" type="hidden" value="no" /></br>


I want to create a button(s) to check all/uncheck all the check_boxes
if clicked by the user. I was thinking I had to use javascript to do
this, but the erb is appending the value to the name in the HTML
output. What this does is prevent my javascript from recognizing these
check_boxes as a collection named "patient".

What can I do remedy in this? If I could handly all of this with Ruby,
that'd be great, but I don't know how yet.

Thank you for your help!