summaryrefslogtreecommitdiffstats
path: root/user_guide/helpers/form_helper.html
diff options
context:
space:
mode:
authorRick Ellis <rick.ellis@ellislab.com>2008-08-26 21:48:08 +0200
committerRick Ellis <rick.ellis@ellislab.com>2008-08-26 21:48:08 +0200
commit2594953f7f75a605a4e59aeb5b06feb4d6db50fb (patch)
tree84048936c4826ab0b2f5711afc4596cc6958c6ef /user_guide/helpers/form_helper.html
parent43e0fbb650d05466cd2568b8a2cc1c38849a6b52 (diff)
Added Form Validation Library and updated docs
Diffstat (limited to 'user_guide/helpers/form_helper.html')
-rw-r--r--user_guide/helpers/form_helper.html57
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();
&lt;/fieldset&gt;</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' =&gt; 'address_info', 'class' =&gt; 'address_info');<br />
- echo form_fieldset('Address Information', $attributes);<br />
+ echo form_fieldset('Address Information', $attributes);<br />
echo &quot;&lt;p&gt;fieldset content here&lt;/p&gt;\n&quot;;<br />
echo form_fieldset_close(); <br />
<br />
@@ -269,7 +269,7 @@ echo form_fieldset_close(); <br />
&lt;/fieldset&gt;</code></p>
<h2>form_fieldset_close()</h2>
<p>Produces a closing &lt;/fieldset&gt; 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 = &quot;&lt;/div&gt;&lt;/div&gt;&quot;;<br />
<br />
echo fieldset_close($string);<br />
@@ -321,7 +321,7 @@ fourth parameter:</p>
<br />
&lt;input type=&quot;submit&quot; name=&quot;mysubmit&quot; value=&quot;Submit Post!&quot; /&gt;</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 &lt;label&gt;. Simple example:</p>
<code>echo form_label('What is your Name', 'username');<br />
@@ -329,13 +329,13 @@ fourth parameter:</p>
// Would produce:
<br />
&lt;label for=&quot;username&quot;&gt;What is your Name&lt;/label&gt;</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 />
&nbsp;&nbsp;&nbsp;&nbsp;'class' =&gt; 'mycustomclass',<br />
&nbsp;&nbsp;&nbsp;&nbsp;'style' =&gt; '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 />
&lt;label for=&quot;username&quot; class=&quot;mycustomclass&quot; style=&quot;color: #000;&quot;&gt;What is your Name&lt;/label&gt;</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>&lt;input type="text" name="quantity" value="<dfn>&lt;?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>&lt;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>
+&lt;select name="myselect"><br />
+&lt;option value="one" <dfn>&lt;?php echo set_select('myselect', 'one', TRUE); ?></dfn> >One&lt;/option><br />
+&lt;option value="two" <dfn>&lt;?php echo set_select('myselect', 'two'); ?></dfn> >Two&lt;/option><br />
+&lt;option value="three" <dfn>&lt;?php echo set_select('myselect', 'three'); ?></dfn> >Three&lt;/option><br />
+&lt;/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>&lt;input type="checkbox" name="mycheck" value="1" <dfn>&lt;?php echo set_checkbox('mycheck', '1'); ?></dfn> /><br />
+&lt;input type="checkbox" name="mycheck" value="2" <dfn>&lt;?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>&lt;input type="radio" name="myradio" value="1" <dfn>&lt;?php echo set_radio('myradio', '1', TRUE); ?></dfn> /><br />
+&lt;input type="radio" name="myradio" value="2" <dfn>&lt;?php echo set_radio('myradio', '2'); ?></dfn> /></code>
+
+
</div>