summaryrefslogtreecommitdiffstats
path: root/user_guide/helpers/form_helper.html
diff options
context:
space:
mode:
Diffstat (limited to 'user_guide/helpers/form_helper.html')
-rw-r--r--user_guide/helpers/form_helper.html49
1 files changed, 41 insertions, 8 deletions
diff --git a/user_guide/helpers/form_helper.html b/user_guide/helpers/form_helper.html
index 95041e562..fa33e6a48 100644
--- a/user_guide/helpers/form_helper.html
+++ b/user_guide/helpers/form_helper.html
@@ -288,12 +288,12 @@ echo fieldset_close($string);<br />
<p>Similar to the other form functions in this helper, you can also pass an array of attributes to the function:</p>
<code>$data = array(<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=> 'newsletter',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'id'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=> 'newsletter',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'value'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=> 'accept',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'checked'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=> TRUE,<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'style'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; => 'margin:10px',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />
+&nbsp;&nbsp;&nbsp;&nbsp;'name'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=> 'newsletter',<br />
+&nbsp;&nbsp;&nbsp;&nbsp;'id'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=> 'newsletter',<br />
+&nbsp;&nbsp;&nbsp;&nbsp;'value'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=> 'accept',<br />
+&nbsp;&nbsp;&nbsp;&nbsp;'checked'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=> TRUE,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;'style'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; => 'margin:10px',<br />
+&nbsp;&nbsp;&nbsp;&nbsp;);<br />
<br />
echo form_checkbox($data);<br />
<br />
@@ -331,8 +331,8 @@ fourth parameter:</p>
&lt;label id=&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><code>$attributes = array(<br />
- 'class' =&gt; 'mycustomclass',<br />
- 'style' =&gt; 'color: #000;',<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 />
@@ -342,6 +342,39 @@ fourth parameter:</p>
<p>Lets you generate a standard reset button. Use is identical to <dfn>form_submit()</dfn>.</p>
+<h2>form_button()</h2>
+
+<p>Lets you generate a standard button element. You can minimally pass the button name and content in the first and second parameter:</p>
+<code>
+echo form_button(’name’,’content’);<br />
+<br />
+// Would produce<br />
+&lt;button name="name" type="submit"&gt;Content&lt;/button&gt;
+</code>
+
+Or you can pass an associative array containing any data you wish your form to contain:
+<code>
+$data = array(<br />
+&nbsp;&nbsp;&nbsp;&nbsp;‘name’ => ‘button’,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;‘id’ => ‘button’,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;‘value’ => ‘true’,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;‘type’ => ‘reset’,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;‘content’ => ‘Reset’<br />
+);<br />
+<br />
+echo form_button($data);<br />
+<br />
+// Would produce:<br />
+&lt;button name="button" id="button" value="true" type="reset"&gt;Reset&lt;/button&gt;
+</code>
+
+If you would like your form to contain some additional data, like JavaScript, you can pass it as a string in the third parameter:
+<code>
+$js = ‘onClick="some_function()"’;<br /><br />
+echo form_button(’mybutton’, ‘Click Me’, $js);
+</code>
+
+
<h2>form_close()</h2>
<p>Produces a closing &lt;/form> tag. The only advantage to using this function is it permits you to pass data to it