From 82654c38441540e14096ec0fd95623af14d165ee Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 20 Oct 2006 23:07:40 +0000 Subject: --- user_guide/libraries/validation.html | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'user_guide/libraries/validation.html') 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 trim, htmlspecialchars, urldecode, etc.

Where rule corresponds to the name of a particular rule, and Error Message is the text you would like displayed.

+

Dealing with Select Menus, Radio Buttons, and Checkboxes

+ +

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:

+ +

set_select()

+ +

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:

+ + +<select name="myselect">
+<option value="one" <?= $this->validation->set_select('myselect', 'one'); ?> >One</option>
+<option value="two" <?= $this->validation->set_select('myselect', 'two'); ?> >Three</option>
+<option value="three" <?= $this->validation->set_select('myselect', 'three'); ?> >Three</option>
+</select> +
+ + +

set_checkbox()

+ +

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:

+ +<input type="checkbox" name="mycheck" value="1" <?= $this->validation->set_checkbox('mycheck', 1); ?> /> + + +

set_radio()

+ +

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:

+ +<input type="radio" name="myradio" value="1" <?= $this->validation->set_radio('myradio', 1); ?> /> + + + + + -- cgit v1.2.3-24-g4f1b