Spry User Guide - Support - Adobe
Spry User Guide - Support - Adobe
Spry User Guide - Support - Adobe
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<br />
6 Add a container around the checkboxes by inserting span tags around the input tags, and assigning a unique ID<br />
to the widget, as follows:<br />
<br />
<br />
<br />
<br />
7 To initialize the <strong>Spry</strong> validation checkbox object, insert the following script block after the HTML code for the<br />
widget:<br />
<br />
var sprycheckbox1 = new <strong>Spry</strong>.Widget.ValidationCheckbox("sprycheckbox1");<br />
<br />
The new JavaScript operator initializes the Checkbox widget object, and transforms the span tag content with the ID<br />
of sprycheckbox1 from static HTML code into an interactive checkbox object. The <strong>Spry</strong>.Widget.ValidationCheckbox<br />
method is a constructor in the <strong>Spry</strong> framework that creates checkbox objects. The information<br />
necessary to initialize the object is contained in the <strong>Spry</strong>ValidationCheckbox.js JavaScript library that you linked to<br />
at the beginning of this procedure.<br />
Make sure that the ID of the checkbox widget’s container span tag matches the ID parameter you specified in the<br />
<strong>Spry</strong>.Widgets.ValidationCheckbox method. Make sure that the JavaScript call comes after the HTML code for<br />
the widget.<br />
8 Save the page.<br />
The complete code looks as follows:<br />
<br />
...<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
var sprycheckbox1 = new <strong>Spry</strong>.Widget.ValidationCheckbox("sprycheckbox1");<br />
<br />
<br />
Display error messages<br />
❖ Create a span tag (or any other type of tag) to display the error message, and assign the appropriate class to it, as<br />
follows:<br />
<br />
<br />
<br />
Please make a selection.<br />
<br />
SPRY<br />
<strong>User</strong> <strong>Guide</strong><br />
87