summaryrefslogtreecommitdiffstats
path: root/user_guide
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2008-03-18 12:50:00 +0100
committerDerek Allard <derek.allard@ellislab.com>2008-03-18 12:50:00 +0100
commit707d0e0f1e0ea922fbe38d8b43f1fb4e2ea001e5 (patch)
tree7c82f6932d6bc2c4e079d7bedb67e9299607eaf4 /user_guide
parentd888c3551189526e1b63cf09206dd40aad5bff5b (diff)
added form_button to form helper
Diffstat (limited to 'user_guide')
-rw-r--r--user_guide/changelog.html1
-rw-r--r--user_guide/helpers/form_helper.html49
2 files changed, 42 insertions, 8 deletions
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index b8bbb330e..7ba6c3e7b 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -69,6 +69,7 @@ Change Log
<ul>
<li>Added increased security for filename handling in the Upload library.</li>
<li>Added increased security for sessions for client-side data tampering.</li>
+ <li>Added <kbd>form_button()</kbd> in the <a href="helpers/form_helper.html">Form helper</a>.</li>
</ul>
</li>
<li>Helpers
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