I've run into a problem with editing a form that has an array of checkboxes. I'm using the following code so that the value is set to 0 if the checkbox is unchecked...
However, when using the DB Record Loader, if a checkbox had been checked, it sets the hidden value to '1' . This becomes a problem when the box is then unchecked as the DB Save action will save the value as '1' instead of '0' for an unchecked box.
If I don't use the hidden fields, then nothing is saved for unchecked boxes and it obviously leads to the wrong boxes being checked on a DB Record Loader (since the arrays will no longer match up).
What am I missing here? Is there any way to tell the DB Record Loader not to fill hidden values?
<td>
<input type="hidden" name="day_28[0]" title="LEH" value="0"/>
<input type="checkbox" name="day_28[0]" title="LEH" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[1]" title="BAT" value="0"/>
<input type="checkbox" name="day_28[1]" title="BAT" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[2]" title="HYB" value="0"/>
<input type="checkbox" name="day_28[2]" title="HYB" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[3]" title="ONE" value="0"/>
<input type="checkbox" name="day_28[3]" title="ONE" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[4]" title="CAS" value="0"/>
<input type="checkbox" name="day_28[4]" title="CAS" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[5]" title="MGS" value="0"/>
<input type="checkbox" name="day_28[5]" title="MGS" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[6]" title="KGS" value="0"/>
<input type="checkbox" name="day_28[6]" title="KGS" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[7]" title="PRR" value="0"/>
<input type="checkbox" name="day_28[7]" title="PRR" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[8]" title="OIB" value="0"/>
<input type="checkbox" name="day_28[8]" title="OIB" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[9]" title="IST" value="0"/>
<input type="checkbox" name="day_28[9]" title="IST" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[10]" title="STB" value="0"/>
<input type="checkbox" name="day_28[10]" title="STB" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[11]" title="TRP" value="0"/>
<input type="checkbox" name="day_28[11]" title="TRP" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[12]" title="TEP" value="0"/>
<input type="checkbox" name="day_28[12]" title="TEP" value="1"/>
</td>
<td>
<input maxlength="50" size="15" type="text" name="day_28[13]" title="RigWell" value="none"/>
</td>
However, when using the DB Record Loader, if a checkbox had been checked, it sets the hidden value to '1' . This becomes a problem when the box is then unchecked as the DB Save action will save the value as '1' instead of '0' for an unchecked box.
<td>
<input type="hidden" name="day_28[0]" title="LEH" value="1"/>
<input type="checkbox" name="day_28[0]" title="LEH" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[1]" title="BAT" value="1"/>
<input type="checkbox" name="day_28[1]" title="BAT" value="1"/>
</td>
<td>
<input type="hidden" name="day_28[2]" title="HYB" value="1"/>
<input type="checkbox" name="day_28[2]" title="HYB" value="2"/>
</td>
etc...
If I don't use the hidden fields, then nothing is saved for unchecked boxes and it obviously leads to the wrong boxes being checked on a DB Record Loader (since the arrays will no longer match up).
What am I missing here? Is there any way to tell the DB Record Loader not to fill hidden values?