From 4b7ac55780bc5bb4c65bb9fc45b7607b67dc64d6 Mon Sep 17 00:00:00 2001 From: Rajinder Yadav Date: Mon, 8 Nov 2010 04:17:56 -0500 Subject: removed indentation, for code style consistency and readibility --- railties/guides/source/form_helpers.textile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'railties/guides/source/form_helpers.textile') 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 <%= 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") %> output: - + - + 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 <%= 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") %> output: - + - + 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". -- cgit v1.2.3