Welcome to Dream.In.Code
Become an Expert!

Join 136,947 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,871 people online right now. Registration is fast and FREE... Join Now!




putting more things onto params

 
Reply to this topicStart new topic

putting more things onto params

spullen
15 Jun, 2007 - 06:45 PM
Post #1

D.I.C Regular
Group Icon

Joined: 22 Mar, 2007
Posts: 330



Thanked: 1 times
Dream Kudos: 50
My Contributions
I have a form and I am trying to get it to add another parameter without
entering it in a field.
I have the form partial _form.rhtml
CODE

<%= error_messages_for 'response' %>

<!--[form:response]-->
<p><label for="response_title">Title</label><br/>
<%= text_field 'response', 'title'  %></p>

<p><label for="response_body">Body</label><br/>
<%= text_area 'response', 'body'  %></p>

<p><label for="response_user">User</label><br/>
<%= text_field 'response', 'user'  %></p>

<p><label for="response_date">Date</label><br/>
<%= datetime_select 'response', 'date'  %></p>
<%= params[:id]%>
<!--[eoform:response]-->

when it goes the controller it passes all the params as
params[:response], but I want to add that params[:id] that I passed in so I can read all of those when I go to the controller,
I can get that to print out so I know it is there. Any suggestions?


EDIT:

I found a solution. You can use hidden_field and have the same parameters as text_field, and then have :value => "something"
CODE
<%= hidden_field 'response', 'message_id', :value => params[:id] %>


This post has been edited by Amadeus: 16 Jun, 2007 - 05:44 AM
User is offlineProfile CardPM
+Quote Post

spullen
RE: Putting More Things Onto Params
4 Sep, 2007 - 05:48 PM
Post #2

D.I.C Regular
Group Icon

Joined: 22 Mar, 2007
Posts: 330



Thanked: 1 times
Dream Kudos: 50
My Contributions
O yeah I also found you can do something like params[:somethings][:other] = "something" if you wanted to add radnom things in the controller.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 11:26PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month