Welcome to Dream.In.Code
Getting Help is Easy!

Join 86,390 Programmers. There are 1,374 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

putting more things onto params

 
Reply to this topicStart new topic

putting more things onto params

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


D.I.C Regular

Group Icon
Joined: 22 Mar, 2007
Posts: 330



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 - 06:44 AM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


spullen
post 4 Sep, 2007 - 06:48 PM
Post #2


D.I.C Regular

Group Icon
Joined: 22 Mar, 2007
Posts: 330

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
Go to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 5/17/08 04:58AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month