Francis Sinson wrote:> Lalala Liliil wrote:
>> hi
>> in my rhtml file i have
>>
>> <form name="par2">
>> <%= hidden_field_tag ''fc'', 42,
:id=>''fc'' %>
>> </form>
>>
>> how can i set params[:blah] to have the value of fc, so i can access
the
>> value of fc through params[:blah] in my controller ?
>>
>> thank you
>
> well, you have to change this:
>
> <%= hidden_field_tag ''blah'', 42,
:id=>''fc'' %>
>
> to access it as params[:blah] in your controller.
>
> Hope that helps:)
<form name="par2">
<%= hidden_field_tag ''fc1'', 42,
:id=>''fc2'' %>
</form>
what if I want to fill the value using javascript? Let''s say instead of
42, I want the return value of js() to be the value of this hidden
field. Is there a way of doing this?
Usually using javascript I can access a hidden field value using:
document.formName.fieldName.value. Please correct me, in this case the
formName = par2 and what is the fieldName ? Is it fc1 or fc2?
Let''s say it is fc1, when I do document.par2.fc1.value = 12, Will 12 be
the value of params[:fc1] in my controller?
I come up to this question because I want to pass value from javascript
to ruby, and thinking that I can just put the javascript value to hidden
field and let rails grab the value from hidden field
Thank you for replying
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---