W
walkerhunter
I have the three embedded Ruby(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".
I know this isn't a pure javascript question, but I am at a loss. I am
new to both languages, which doesn't help either.
Thank you for your time!
-Hunter
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".
I know this isn't a pure javascript question, but I am at a loss. I am
new to both languages, which doesn't help either.
Thank you for your time!
-Hunter