On Sun, Dec 4, 2011 at 7:38 PM, Guru R. <[email protected]> wrote:
> i m trying to read the input of the radio button and compare it with a
> string and further increment a count variable as per the result of
> comparison.i e used
>
> <%= form_for(@abc) do |f| %>
> <div id="radio_buttons">
> <%= radio_button_tag 'exp', 2 %>2
> <%= radio_button_tag 'exp', 1 %>1
> <%= link_to 'Submit now', {:action=>"destroy"},:remote => true, :submit
> =>
> 'radio_buttons' %>
> </div>
> <%end%>
>
>From the api
*radio_button_tag*(name, value, checked = false, options = {})
the third argument is defaulted to false so your radio buttons start as not
checked.
you need to check at least one before the form can submit the value of the
radio
button you checked.
You might also want to check your code below.
>
> def destroy
> $score= params[:exp];
>
Someone correct me if I'm wrong but it's not good practice to prepend a
variable with $ in ruby.
> if params[:exp] = '1'
>
The line above sets params[:exp] to '1' so @ac below will always be equal
to '1'
> @ac=params[:exp]
> end
> end
> I m not able to see the parameter either $score or @ac
>
> Kindly give me the solution
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.