brent brent
2012-Jan-06 16:59 UTC
How to pass a field from simple_form as a hidden div value
Hi folks Im trying to pass a value to my hidden div using simple_form but im not sure how to do this, was wondering if anyone could help me with this. Here is my view using simple_form <%= f.label "First name" %> <%= f.text_field :first_name %> <%= f.label "Last name" %> <%= f.text_field :last_name %> <%= f.input :full_name, :as => :hidden, :input_html => { :value => [:first_name, :last_name].join('' '') } %> <%= f.submit %> If ive already got the first and last name from the input fields how can i pass those values to the hidden div? This code above isnt working. Thanks -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Linus Pettersson
2012-Jan-06 17:06 UTC
Re: How to pass a field from simple_form as a hidden div value
You have to use Javascript for that. Why do you want to do this anyway? If you just want to combine "First" and "Last" to one string "First Last", do it when you receive the data in the controller or model. Regards Linus -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/K_-ZBmpI9x4J. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.