hi
in my rhtml file i have
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
hi
in my rhtml file i have
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
Francis S. wrote:
<%= hidden_field_tag 'fc1', 42, :id=>'fc2' %> 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?Lalala L. wrote:
hi
<%= hidden_field_tag 'fc', 42, :id=>'fc' %>
in my rhtml file i havehow 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:)
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
Lalala L. wrote:
hi
<%= hidden_field_tag 'fc', 42, :id=>'fc' %>
in my rhtml file i havehow 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:)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs