Skip to primary content

42

Web notebook about thoughts and discoveries in DevOps, SRE, Software Engineering….

42

Main menu

  • Home
  • About
  • contact
  • Links

Post navigation

← Previous Next →

adding parameter as a hidden field in rails form

Posted on 2 September 2011 by kosmas
Email this to someone
email
Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin

Problem
You want to add a hidden field that contains a url parameter in a rails form.

Solution
Use the following in your form view (ie new.html.erb):
<%= f.hidden_field :hidden_field_name, { :value => params[:url_param_value]} %>

This entry was posted in ruby on rails and tagged rails hidden_field form by kosmas. Bookmark the permalink.
Proudly powered by WordPress