XModPro

Jquery Assistance

Mark Trippier Mark Trippier posted Jul 3, 2015
Active Jul 28 · Viewed 1302 times

Hi Gurus,

I have a table in an XMOD Add form that contains 7 seperate checkboxes. When ticked they simply update a corresponding field in the database with a 1.

I would like to have the check box - ID="COTYPE_ALL" - selected by default. But if any of the other checkboxes (ID="COTYPE_A",ID="COTYPE_B",ID="COTYPE_C") are selected I require the change event to deselect the checkbox ID="COTYPE_ALL". If at any time during checking, unchecking all checkboxes are deselected, I require the original checkbox ID="COTYPE_ALL" to be automatically selected again.

The only jQuery example I can find uses a Checkbox list, and I would rather use individual checkboxes as I require one entry per field in the database.

I really appreciate and assistance, fiddles etc. that you can offer to help me achieve this.

Many Thanks

Mark.

In case the table code is relevant in helping you see how I have laid this out, naming conventions etc, I will attempt to past the table containing the checkboxes below:

<table>
<tr>
<td colspan="6" style="padding-left:5px;">
Company Type Selection
</td>
</tr>
<tr>
<td>
<div>
<Label CssClass="xmp-form-label NormalBold" For="COTYPE_ALL">All Company Types</Label>
<CheckBox Id="COTYPE_ALL" Nullable="true" DataField="COTYPE_ALL" Checked="True" value="1" DataType="string"></CheckBox>
</div>
</td>
<td>
<div>
<Label CssClass="xmp-form-label NormalBold" For="COTYPE_A">Limited Company</Label>
<CheckBox Id="COTYPE_A" Nullable="true" DataField="COTYPE_A" DataType="string"></CheckBox>
</div>
</td>
<td>
<div>
<Label CssClass="xmp-form-label NormalBold" For="COTYPE_B">PLC Company</Label>
<CheckBox Id="COTYPE_B" Nullable="true" DataField="COTYPE_B" DataType="string"></CheckBox>
</div>
</td>
<td>
<div>
<Label CssClass="xmp-form-label NormalBold" For="COTYPE_C">Public Sector</Label>
<CheckBox Id="COTYPE_C" Nullable="true" DataField="COTYPE_C" DataType="string"></CheckBox>
</div>
</td>
<td>
<div>
<Label CssClass="xmp-form-label NormalBold" For="COTYPE_D">Private</Label>
<CheckBox Id="COTYPE_D" Nullable="true" DataField="COTYPE_D" DataType="string"></CheckBox>
</div>
</td>
<td>
<div>
<Label CssClass="xmp-form-label NormalBold" For="COTYPE_E">Partnership</Label>
<CheckBox Id="COTYPE_E" Nullable="true" DataField="COTYPE_E" DataType="string"></CheckBox>
</div>
</td>
<td>
<div>
<Label CssClass="xmp-form-label NormalBold" For="COTYPE_F">Other</Label>
<CheckBox Id="COTYPE_F" Nullable="true" DataField="COTYPE_F" DataType="string"></CheckBox>
</div>
</td>
</tr>
</table>

6 Replies

Loading replies...