diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-05-08 17:23:36 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-05-08 17:23:36 +0200 |
commit | 0854d91fd2848266ec37a37c8a1ccfd13a8a4eda (patch) | |
tree | 1433f1db86920fae6e6286c6cc517ba64cda2aba /user_guide/helpers/form_helper.html | |
parent | 0cb8c59f91567af9aa6530f8764abafe1ae935c0 (diff) | |
parent | 3ef65bd7491f847fecdab1acc9687f0e90eee09b (diff) |
Merged tip.
Diffstat (limited to 'user_guide/helpers/form_helper.html')
-rw-r--r-- | user_guide/helpers/form_helper.html | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/user_guide/helpers/form_helper.html b/user_guide/helpers/form_helper.html index 0a84fde66..b4a5730f2 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 2.0.1</h1></td> +<td><h1>CodeIgniter User Guide Version 2.0.2</h1></td> <td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td> </tr> </table> @@ -72,7 +72,7 @@ Form Helper <h2>form_open()</h2> -<p>Creates an opening form tag with a base URL <strong>built from your config preferences</strong>. It will optionally let you +<p>Creates an opening form tag with a base URL <strong>built from your config preferences</strong>. It will optionally let you add form attributes and hidden input fields, and will always add the attribute <kbd>accept-charset</kbd> based on the charset value in your config file.</p> <p>The main benefit of using this tag rather than hard coding your own HTML is that it permits your site to be more portable @@ -122,7 +122,7 @@ which is necessary if you would like to use the form to upload files with.</p> <h2>form_hidden()</h2> -<p>Lets you generate hidden input fields. You can either submit a name/value string to create one field:</p> +<p>Lets you generate hidden input fields. You can either submit a name/value string to create one field:</p> <code>form_hidden('username', 'johndoe');<br /> <br /> @@ -149,7 +149,7 @@ echo form_hidden($data);<br /> <h2>form_input()</h2> -<p>Lets you generate a standard text input field. You can minimally pass the field name and value in the first +<p>Lets you generate a standard text input field. You can minimally pass the field name and value in the first and second parameter:</p> <code>echo form_input('username', 'johndoe');</code> @@ -196,9 +196,9 @@ example, you will instead specify "rows" and "cols".</p> <h2>form_dropdown()</h2> -<p>Lets you create a standard drop-down field. The first parameter will contain the name of the field, +<p>Lets you create a standard drop-down field. The first parameter will contain the name of the field, the second parameter will contain an associative array of options, and the third parameter will contain the -value you wish to be selected. You can also pass an array of multiple items through the third parameter, and CodeIgniter will create a multiple select for you. Example:</p> +value you wish to be selected. You can also pass an array of multiple items through the third parameter, and CodeIgniter will create a multiple select for you. Example:</p> <code>$options = array(<br /> 'small' => 'Small Shirt',<br /> @@ -215,7 +215,7 @@ echo form_dropdown('shirts', $options, 'large');<br /> <br /> <select name="shirts"><br /> <option value="small">Small Shirt</option><br /> -<option value="med">Medium Shirt</option><br /> +<option value="med">Medium Shirt</option><br /> <option value="large" selected="selected">Large Shirt</option><br /> <option value="xlarge">Extra Large Shirt</option><br /> </select><br /> @@ -226,7 +226,7 @@ echo form_dropdown('shirts', $options, $shirts_on_sale);<br /> <br /> <select name="shirts" multiple="multiple"><br /> <option value="small" selected="selected">Small Shirt</option><br /> -<option value="med">Medium Shirt</option><br /> +<option value="med">Medium Shirt</option><br /> <option value="large" selected="selected">Large Shirt</option><br /> <option value="xlarge">Extra Large Shirt</option><br /> </select></code> @@ -243,9 +243,9 @@ echo form_dropdown('shirts', $options, 'large', $js);</code> <h2>form_multiselect()</h2> -<p>Lets you create a standard multiselect field. The first parameter will contain the name of the field, +<p>Lets you create a standard multiselect field. The first parameter will contain the name of the field, the second parameter will contain an associative array of options, and the third parameter will contain the -value or values you wish to be selected. The parameter usage is identical to using <kbd>form_dropdown()</kbd> above, +value or values you wish to be selected. The parameter usage is identical to using <kbd>form_dropdown()</kbd> above, except of course that the name of the field will need to use POST array syntax, e.g. <samp>foo[]</samp>.</p> @@ -267,7 +267,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 /> @@ -277,11 +277,11 @@ echo form_fieldset_close(); <br /> <p>form content here</p> <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> +<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> <code>$string = "</div></div>";<br /> <br /> -echo fieldset_close($string);<br /> +echo form_fieldset_close($string);<br /> <br /> // Would produce:<br /> </fieldset><br /> @@ -309,7 +309,7 @@ echo form_checkbox($data);<br /> // Would produce:<br /><br /> <input type="checkbox" name="newsletter" id="newsletter" value="accept" checked="checked" style="margin:10px" /></code> -<p>As with other functions, if you would like the tag to contain additional data, like JavaScript, you can pass it as a string in the +<p>As with other functions, if you would like the tag to contain additional data, like JavaScript, you can pass it as a string in the fourth parameter:</p> <code>$js = 'onClick="some_function()"';<br /> @@ -330,7 +330,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 /> @@ -338,13 +338,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> @@ -386,8 +386,8 @@ echo form_button('mybutton', 'Click Me', $js); <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 -which will be added below the tag. For example:</p> +<p>Produces a closing </form> 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> <code>$string = "</div></div>";<br /> <br /> @@ -404,7 +404,7 @@ echo form_close($string);<br /> <h2>form_prep()</h2> -<p>Allows you to safely use HTML and characters such as quotes within form elements without breaking out of the form. Consider this example:</p> +<p>Allows you to safely use HTML and characters such as quotes within form elements without breaking out of the form. Consider this example:</p> <code>$string = 'Here is a string containing <strong>"quoted"</strong> text.';<br /> <br /> @@ -431,7 +431,7 @@ The second (optional) parameter allows you to set a default value for the form. <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 +<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> @@ -439,16 +439,16 @@ each item, and the third (optional) parameter lets you set an item as the defaul <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 /> +<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 +<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 /> @@ -459,8 +459,8 @@ must contain the name of the checkbox, the second parameter must contain its val <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> +<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> |