diff options
Diffstat (limited to 'user_guide/libraries/validation.html')
-rw-r--r-- | user_guide/libraries/validation.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/user_guide/libraries/validation.html b/user_guide/libraries/validation.html index 3a724831f..1af3c32fa 100644 --- a/user_guide/libraries/validation.html +++ b/user_guide/libraries/validation.html @@ -664,6 +664,45 @@ like <kbd>trim</kbd>, <kbd>htmlspecialchars</kbd>, <kbd>urldecode</kbd>, etc.</p <p>Where <var>rule</var> corresponds to the name of a particular rule, and <var>Error Message</var> is the text you would like displayed.</p>
+<h2>Dealing with Select Menus, Radio Buttons, and Checkboxes</h2>
+
+<p>If you use select menues, radio buttons or checkboxes, you will want the state of
+these items to be retained in the event of an error. The Validation class has three functions taht help you do this:</p>
+
+<h2>set_select()</h2>
+
+<p>Permits you to display the menu item that was selected. The first parameter
+must contain the name of the select menu, the second parameter must contain the value of
+each item. Example:</p>
+
+<code>
+<select name="myselect"><br />
+<option value="one" <dfn><?= $this->validation->set_select('myselect', 'one'); ?></dfn> >One</option><br />
+<option value="two" <dfn><?= $this->validation->set_select('myselect', 'two'); ?></dfn> >Three</option><br />
+<option value="three" <dfn><?= $this->validation->set_select('myselect', 'three'); ?></dfn> >Three</option><br />
+</select>
+</code>
+
+
+<h2>set_checkbox()</h2>
+
+<p>Permits you to display a checkbox in the state it was submitted. The first parameter
+must contain the name of the checkbox, the second parameter must contain its value. Example:</p>
+
+<code><input type="checkbox" name="mycheck" value="1" <dfn><?= $this->validation->set_checkbox('mycheck', 1); ?></dfn> /></code>
+
+
+<h2>set_radio()</h2>
+
+<p>Permits you to display radio buttons in the state they were submitted. The first parameter
+must contain the name of the radio button, the second parameter must contain its value. Example:</p>
+
+<code><input type="radio" name="myradio" value="1" <dfn><?= $this->validation->set_radio('myradio', 1); ?></dfn> /></code>
+
+
+
+
+
</div>
<!-- END CONTENT -->
|