diff options
author | Rajinder Yadav <devguy.ca@gmail.com> | 2010-11-08 04:17:56 -0500 |
---|---|---|
committer | Rajinder Yadav <devguy.ca@gmail.com> | 2010-11-08 04:17:56 -0500 |
commit | 4b7ac55780bc5bb4c65bb9fc45b7607b67dc64d6 (patch) | |
tree | a99712c34216e0d4ba8652ccaa109bc4eafc4ab5 /railties/guides | |
parent | 149f795d168897d36ce07a243b3e83ba724752ab (diff) | |
download | rails-4b7ac55780bc5bb4c65bb9fc45b7607b67dc64d6.tar.gz rails-4b7ac55780bc5bb4c65bb9fc45b7607b67dc64d6.tar.bz2 rails-4b7ac55780bc5bb4c65bb9fc45b7607b67dc64d6.zip |
removed indentation, for code style consistency and readibility
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/source/form_helpers.textile | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/railties/guides/source/form_helpers.textile b/railties/guides/source/form_helpers.textile index 16aad5aa9e..3b7cd2a7ab 100644 --- a/railties/guides/source/form_helpers.textile +++ b/railties/guides/source/form_helpers.textile @@ -127,18 +127,18 @@ Checkboxes are form controls that give the user a set of options they can enable <erb> <%= check_box_tag(:pet_dog) %> - <%= label_tag(:pet_dog, "I own a dog") %> +<%= label_tag(:pet_dog, "I own a dog") %> <%= check_box_tag(:pet_cat) %> - <%= label_tag(:pet_cat, "I own a cat") %> +<%= label_tag(:pet_cat, "I own a cat") %> </erb> output: <html> <input id="pet_dog" name="pet_dog" type="checkbox" value="1" /> - <label for="pet_dog">I own a dog</label> +<label for="pet_dog">I own a dog</label> <input id="pet_cat" name="pet_cat" type="checkbox" value="1" /> - <label for="pet_cat">I own a cat</label> +<label for="pet_cat">I own a cat</label> </html> The second parameter to +check_box_tag+ is the value of the input. This is the value that will be submitted by the browser if the checkbox is ticked (i.e. the value that will be present in the +params+ hash). With the above form you would check the value of +params[:pet_dog]+ and +params[:pet_cat]+ to see which pets the user owns. @@ -149,18 +149,18 @@ Radio buttons, while similar to checkboxes, are controls that specify a set of o <erb> <%= radio_button_tag(:age, "child") %> - <%= label_tag(:age_child, "I am younger than 21") %> +<%= label_tag(:age_child, "I am younger than 21") %> <%= radio_button_tag(:age, "adult") %> - <%= label_tag(:age_adult, "I'm over 21") %> +<%= label_tag(:age_adult, "I'm over 21") %> </erb> output: <html> <input id="age_child" name="age" type="radio" value="child" /> - <label for="age_child">I am younger than 21</label> +<label for="age_child">I am younger than 21</label> <input id="age_adult" name="age" type="radio" value="adult" /> - <label for="age_adult">I'm over 21</label> +<label for="age_adult">I'm over 21</label> </html> As with +check_box_tag+ the second parameter to +radio_button_tag+ is the value of the input. Because these two radio buttons share the same name (age) the user will only be able to select one and +params[:age]+ will contain either "child" or "adult". |