diff options
Diffstat (limited to 'user_guide/helpers/form_helper.html')
-rw-r--r-- | user_guide/helpers/form_helper.html | 57 |
1 files changed, 50 insertions, 7 deletions
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 @@ <div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
-<td><h1>CodeIgniter User Guide Version 1.6.3</h1></td>
+<td><h1>CodeIgniter User Guide Version 1.7</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
@@ -258,7 +258,7 @@ echo form_fieldset_close(); </fieldset></code>
<p>Similar to other functions, you can submit an associative array in the second parameter if you prefer to set additional attributes. </p>
<p><code>$attributes = array('id' => 'address_info', 'class' => 'address_info');<br />
- echo form_fieldset('Address Information', $attributes);<br />
+ echo form_fieldset('Address Information', $attributes);<br />
echo "<p>fieldset content here</p>\n";<br />
echo form_fieldset_close(); <br />
<br />
@@ -269,7 +269,7 @@ echo form_fieldset_close(); <br /> </fieldset></code></p>
<h2>form_fieldset_close()</h2>
<p>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:</p>
+ which will be added below the tag. For example:</p>
<code>$string = "</div></div>";<br />
<br />
echo fieldset_close($string);<br />
@@ -321,7 +321,7 @@ fourth parameter:</p> <br />
<input type="submit" name="mysubmit" value="Submit Post!" /></code>
<p>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.</p>
+ The third parameter lets you add extra data to your form, like JavaScript.</p>
<h2>form_label()</h2>
<p>Lets you generate a <label>. Simple example:</p>
<code>echo form_label('What is your Name', 'username');<br />
@@ -329,13 +329,13 @@ fourth parameter:</p> // Would produce:
<br />
<label for="username">What is your Name</label></code>
-<p>Similar to other functions, you can submit an associative array in the third parameter if you prefer to set additional attributes. </p>
+<p>Similar to other functions, you can submit an associative array in the third parameter if you prefer to set additional attributes. </p>
<p><code>$attributes = array(<br />
'class' => 'mycustomclass',<br />
'style' => 'color: #000;',<br />
);<br />
- echo form_label('What is your Name', 'username', $attributes);<br />
- <br />
+ echo form_label('What is your Name', 'username', $attributes);<br />
+ <br />
// Would produce: <br />
<label for="username" class="mycustomclass" style="color: #000;">What is your Name</label></code></p>
<h2>form_reset()</h2>
@@ -411,6 +411,49 @@ values will be prepped automatically, so there is no need to call this function. creating your own form elements.</p>
+<h2>set_value()</h2>
+
+<p>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:</p>
+
+<code><input type="text" name="quantity" value="<dfn><?php echo set_value('quantity', '0'); ?></dfn>" size="50" /></code>
+
+<p>The above form will show "0" when loaded for the firs time.</p>
+
+<h2>set_select()</h2>
+
+<p>If you use a <dfn><select></dfn> 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).</p>
+
+<p>Example:</p>
+
+<code>
+<select name="myselect"><br />
+<option value="one" <dfn><?php echo set_select('myselect', 'one', TRUE); ?></dfn> >One</option><br />
+<option value="two" <dfn><?php echo set_select('myselect', 'two'); ?></dfn> >Two</option><br />
+<option value="three" <dfn><?php echo 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, and the third (optional) parameter lets you set an item as the default (use boolean TRUE/FALSE). Example:</p>
+
+<code><input type="checkbox" name="mycheck" value="1" <dfn><?php echo set_checkbox('mycheck', '1'); ?></dfn> /><br />
+<input type="checkbox" name="mycheck" value="2" <dfn><?php echo set_checkbox('mycheck', '2'); ?></dfn> /></code>
+
+
+<h2>set_radio()</h2>
+
+<p>Permits you to display radio buttons in the state they were submitted. This function is identical to the <strong>set_checkbox()</strong> function above.</p>
+
+<code><input type="radio" name="myradio" value="1" <dfn><?php echo set_radio('myradio', '1', TRUE); ?></dfn> /><br />
+<input type="radio" name="myradio" value="2" <dfn><?php echo set_radio('myradio', '2'); ?></dfn> /></code>
+
+
</div>
|