diff options
author | Derek Allard <derek.allard@ellislab.com> | 2008-03-18 12:50:00 +0100 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2008-03-18 12:50:00 +0100 |
commit | 707d0e0f1e0ea922fbe38d8b43f1fb4e2ea001e5 (patch) | |
tree | 7c82f6932d6bc2c4e079d7bedb67e9299607eaf4 /user_guide/helpers | |
parent | d888c3551189526e1b63cf09206dd40aad5bff5b (diff) |
added form_button to form helper
Diffstat (limited to 'user_guide/helpers')
-rw-r--r-- | user_guide/helpers/form_helper.html | 49 |
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 />
- 'name' => 'newsletter',<br />
- 'id' => 'newsletter',<br />
- 'value' => 'accept',<br />
- 'checked' => TRUE,<br />
- 'style' => 'margin:10px',<br />
- );<br />
+ 'name' => 'newsletter',<br />
+ 'id' => 'newsletter',<br />
+ 'value' => 'accept',<br />
+ 'checked' => TRUE,<br />
+ 'style' => 'margin:10px',<br />
+ );<br />
<br />
echo form_checkbox($data);<br />
<br />
@@ -331,8 +331,8 @@ fourth parameter:</p> <label id="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><code>$attributes = array(<br />
- 'class' => 'mycustomclass',<br />
- 'style' => 'color: #000;',<br />
+ 'class' => 'mycustomclass',<br />
+ 'style' => '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 />
+<button name="name" type="submit">Content</button>
+</code>
+
+Or you can pass an associative array containing any data you wish your form to contain:
+<code>
+$data = array(<br />
+ ‘name’ => ‘button’,<br />
+ ‘id’ => ‘button’,<br />
+ ‘value’ => ‘true’,<br />
+ ‘type’ => ‘reset’,<br />
+ ‘content’ => ‘Reset’<br />
+);<br />
+<br />
+echo form_button($data);<br />
+<br />
+// Would produce:<br />
+<button name="button" id="button" value="true" type="reset">Reset</button>
+</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 </form> tag. The only advantage to using this function is it permits you to pass data to it
|