Checkbox controls (like Radio buttons) will have to be handled differently to other CRM field type within HTML. The way they are rendered in HTML must be taken into account.

Checkboxes can theoretically be grouped on the same input name. In fact Fields in Sage CRM that are defined as Checkboxes in meta data are rendered in a distinct form. This means that there would only be once instance of that fields name in the HTML form and that makes things easier for us.

Other field data types in CRM when they rendered in HTML make use of ID properties to ensure that each control can be directly referenced on screen. For example if we first consider a selection list, this produces HTML that looks:

<SPAN ID=_Captcomp_mailrestriction class=VIEWBOXCAPTION>Mail Restriction:</SPAN>
<SPAN ID=_Datacomp_mailrestriction class=VIEWBOX >
<SELECT class=EDIT size=1 name="comp_mailrestriction">
<OPTION Value="N">No</OPTION>;
<OPTION Value="Y">Yes</OPTION>
<OPTION VALUE="" SELECTED>--None--</OPTION>
</SELECT>
<input type=hidden name=_HIDDENcomp_mailrestriction value="">
</SPAN>

In the above example the example the field label and the data are clearly marked using the _captfieldname and _datafieldname ID values.

A Checkbox added to a screen in CRM will generate different HTML:

<input type=checkbox name="comp_test" ID="_IDcomp_test"> </TD>
<input type=hidden name=_HIDDENcomp_test value="">
<LABEL FOR="_IDcomp_test">Test</LABEL>


Given that the HTML form in Sage CRM screens is always called "EntryForm" we can reference our checkbox in client side code like this:

document.EntryForm.myfield //where myfield is the name of your element.
document.EntryForm.elements[i] //where i is the position of the checkbox within form

Sage CRM will also allow you to control the checkbox via the ID. In the above example the Checkbox has an ID "_IDcomp_test" given it, which allows the checkbox to be easily identified for coding.

The <LABEL ...> tag is an HTML element that defines a set of text that is associated with a particular form element. In the example given, this code indicates that the phrase "Test" is associated with the checkbox having the ID "_IDcomp_test". The FOR attribute is required. The value of FOR should be the same as the value of ID in the form field that the label applies to.