04.02.2013 Views

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

Spry User Guide - Support - Adobe

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The checkboxRequiredMsg rule is located in the <strong>Spry</strong>ValidationCheckbox.css file, and is set to display:none by<br />

default. When the widget enters a different state through user interaction, <strong>Spry</strong> applies the appropriate class—the<br />

state class—to the container of the widget. This action affects the error-message class, and by extension, the<br />

appearance of the error message.<br />

For example, the following shows the CSS rule from the <strong>Spry</strong>ValidationCheckbox.css file:<br />

.checkboxRequiredMsg, .checkboxMinSelectionsMsg, .checkboxMaxSelectionsMsg{<br />

display: none;<br />

}<br />

.checkboxRequiredState .checkboxRequiredMsg,<br />

.checkboxMinSelectionsState .checkboxMinSelectionsMsg,<br />

.checkboxMaxSelectionsState .checkboxMaxSelectionsMsg {<br />

display: inline;<br />

color: #CC3333;<br />

border: 1px solid #CC3333;<br />

}<br />

By default, no state class is applied to the widget container, so that when the page loads in a browser, the error<br />

message text in the preceding HTML code example only has the checkboxRequiredMsg class applied to it. (The<br />

property and value pair for this rule is display:none, so the message remains hidden.) If the user fails to make a<br />

selection, however, <strong>Spry</strong> applies the appropriate class to the widget container, as follows:<br />

<br />

<br />

<br />

Please make a selection.<br />

<br />

In the preceding CSS code, the state rule with the contextual selector .checkboxRequiredState .checkboxRequiredMsg<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 />

.checkboxRequiredMsg Causes error message to display when the widget enters<br />

the required state<br />

.checkboxMinSelectionsMsg Causes error message to display when the widget enters<br />

the minimum number of selections state<br />

.checkboxMaxSelectionsMsg Causes error message to display when the widget enters<br />

the maximum number of selections state<br />

Note: You cannot rename state-related class names because they are hard-coded as part of the <strong>Spry</strong> framework.<br />

SPRY<br />

<strong>User</strong> <strong>Guide</strong><br />

88

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!