From 2594953f7f75a605a4e59aeb5b06feb4d6db50fb Mon Sep 17 00:00:00 2001 From: Rick Ellis Date: Tue, 26 Aug 2008 19:48:08 +0000 Subject: Added Form Validation Library and updated docs --- user_guide/helpers/form_helper.html | 57 ++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 7 deletions(-) (limited to 'user_guide/helpers/form_helper.html') diff --git a/user_guide/helpers/form_helper.html b/user_guide/helpers/form_helper.html index 76ded1ee6..868cadb84 100644 --- a/user_guide/helpers/form_helper.html +++ b/user_guide/helpers/form_helper.html @@ -28,7 +28,7 @@
- +

CodeIgniter User Guide Version 1.6.3

CodeIgniter User Guide Version 1.7

@@ -258,7 +258,7 @@ echo form_fieldset_close(); </fieldset>

Similar to other functions, you can submit an associative array in the second parameter if you prefer to set additional attributes.

$attributes = array('id' => 'address_info', 'class' => 'address_info');
- echo form_fieldset('Address Information', $attributes);
+ echo form_fieldset('Address Information', $attributes);
echo "<p>fieldset content here</p>\n";
echo form_fieldset_close();

@@ -269,7 +269,7 @@ echo form_fieldset_close();
</fieldset>

form_fieldset_close()

Produces a closing </fieldset> tag. The only advantage to using this function is it permits you to pass data to it - which will be added below the tag. For example:

+ which will be added below the tag. For example:

$string = "</div></div>";

echo fieldset_close($string);
@@ -321,7 +321,7 @@ fourth parameter:


<input type="submit" name="mysubmit" value="Submit Post!" />

Similar to other functions, you can submit an associative array in the first parameter if you prefer to set your own attributes. - The third parameter lets you add extra data to your form, like JavaScript.

+ The third parameter lets you add extra data to your form, like JavaScript.

form_label()

Lets you generate a <label>. Simple example:

echo form_label('What is your Name', 'username');
@@ -329,13 +329,13 @@ fourth parameter:

// Would produce:
<label for="username">What is your Name</label>
-

Similar to other functions, you can submit an associative array in the third parameter if you prefer to set additional attributes.

+

Similar to other functions, you can submit an associative array in the third parameter if you prefer to set additional attributes.

$attributes = array(
    'class' => 'mycustomclass',
    'style' => 'color: #000;',
);
- echo form_label('What is your Name', 'username', $attributes);
-
+ echo form_label('What is your Name', 'username', $attributes);
+
// Would produce:
<label for="username" class="mycustomclass" style="color: #000;">What is your Name</label>

form_reset()

@@ -411,6 +411,49 @@ values will be prepped automatically, so there is no need to call this function. creating your own form elements.

+

set_value()

+ +

Permits you to set the value of an input form or textarea. You must supply the field name via the first parameter of the function. +The second (optional) parameter allows you to set a default value for the form. Example:

+ +<input type="text" name="quantity" value="<?php echo set_value('quantity', '0'); ?>" size="50" /> + +

The above form will show "0" when loaded for the firs time.

+ +

set_select()

+ +

If you use a <select> menu, this function 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, and the third (optional) parameter lets you set an item as the default (use boolean TRUE/FALSE).

+ +

Example:

+ + +<select name="myselect">
+<option value="one" <?php echo set_select('myselect', 'one', TRUE); ?> >One</option>
+<option value="two" <?php echo set_select('myselect', 'two'); ?> >Two</option>
+<option value="three" <?php echo 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, and the third (optional) parameter lets you set an item as the default (use boolean TRUE/FALSE). Example:

+ +<input type="checkbox" name="mycheck" value="1" <?php echo set_checkbox('mycheck', '1'); ?> />
+<input type="checkbox" name="mycheck" value="2" <?php echo set_checkbox('mycheck', '2'); ?> />
+ + +

set_radio()

+ +

Permits you to display radio buttons in the state they were submitted. This function is identical to the set_checkbox() function above.

+ +<input type="radio" name="myradio" value="1" <?php echo set_radio('myradio', '1', TRUE); ?> />
+<input type="radio" name="myradio" value="2" <?php echo set_radio('myradio', '2'); ?> />
+ +
-- cgit v1.2.3-24-g4f1b