Ruby on Rails
Monday, November 24, 2014
On Sunday, 23 November 2014 08:38:39 UTC-5, Ruby-Forum.com User wrote:
My partial code:
view/clubs_registration/clubs/_dropzone_pictures.html.erb
<%= hidden_field_tag :club_id, name: :club_id, value: club_id %>
`hidden_field_tag` takes three arguments - name, value, and options. http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-hidden_field_tag
In your case, it would look like:
<%= hidden_field_tag :club_id, club_id %>
The third argument is omitted, since you're only looking to set name, id and value on the resulting tag.
--Matt Jones
My initial view code:
view/clubs_registration/clubs/test_dropzone_pictures.html. erb
<%= render partial: 'dropzone_pictures', :locals => { :club_id =>
@club.id } %>
What I really want to do is retrieve the value of club_id from my
jquery:
console.log($("#club_id").val()); //-> {:name=>:club_id,
:value=>11500}
I just want the value 11500. How should I do that please?
--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ea380692-1a4e-402a-b06b-e465d09147aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment