Spry User Guide - Support - Adobe
Spry User Guide - Support - Adobe
Spry User Guide - Support - Adobe
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<br />
--Please select an item--<br />
Item 1<br />
. . .<br />
<br />
Please select an item.<br />
<br />
In the preceding CSS code, the state rule with the contextual selector .selectRequiredState . selectRequiredMsg<br />
overrides the default error-message rule responsible for hiding the error-message text. Thus, when <strong>Spry</strong><br />
applies the state class to the widget container, the state rule determines the appearance of the widget, and displays<br />
the error message inline in red with a 1-pixel solid border.<br />
Following is a list of default error-message classes and their descriptions. You can change these classes and rename<br />
them. If you do so, don’t forget to change them in the contextual selector also.<br />
Error message class Description<br />
.selectRequiredMsg Causes error message to display when the widget enters<br />
the required state<br />
.selectInvalidMsg Causes error message to display when the widget enters<br />
the invalid state<br />
Note: You cannot rename state-related class names because they are hard-coded as part of the <strong>Spry</strong> framework.<br />
Specify when validation occurs<br />
By default, the Validation Select widget validates when the user clicks the submit button. You can, however, set two<br />
other options: blur or change. The validateOn:["blur"] parameter causes the widget to validate whenever the<br />
user clicks outside the select list. The validateOn:["change"] parameter causes the widget to validate as the user<br />
makes selections.<br />
❖ To specify when validation occurs, add a validateOn parameter to the constructor as follows:<br />
<br />
var spryselect1 = new <strong>Spry</strong>.Widget.ValidationSelect("spryselect1",<br />
{validateOn:["blur"]});<br />
<br />
As a convenience, you can discard the brackets if your validateOn parameter contains a single value (for example,<br />
validateOn: "blur"). If the parameter contains both values, however (validateOn:["blur", "change"]),<br />
include brackets in the syntax.<br />
Change required status of a select list<br />
By default, Validation Select widgets require the user to make a selection before submitting the form. You can,<br />
however, make selections optional for the user.<br />
❖ To change the required status of a select list, add the isRequired property to the constructor and set its value to<br />
false, as follows:<br />
<br />
var selectwidget1 = new <strong>Spry</strong>.Widget.ValidationSelect("selectwidget1",<br />
{isRequired:false});<br />
<br />
SPRY<br />
<strong>User</strong> <strong>Guide</strong><br />
81