What's the best way to pass string value from View to Controller?

I need to pass a string value from view to controller besides the
form_remote_tag value…

What’s the best way to do it?

Is it possible to pass a parameter in send_data method?

For instance, send_data( channel_info) ?

Currently, I have the code as follows… but I need to pass in the
string value to controller with chat_input value.

I can really figure out a clean way to do it.

Please let me know. Thanks~!

View code…

<%= form_remote_tag( :url => { :action => :send_data }, :complete =>
“$(‘chat_input’).value = ‘’” ) %>
<%= text_field_tag( ‘chat_input’, ‘’, { :size => 20, :id =>
‘chat_input’} ) %>
<%= submit_tag “Add” %>

Controller code…

def send_data


You’re already doing it. you just just add more fields to the form
on what information exactly you want to send to the page.

On Dec 28, 2007 11:42 AM, coolJay [email protected] wrote:

“$(‘chat_input’).value = ‘’” ) %>

Ryan B.

Feel free to add me to MSN and/or GTalk as this email.


Thanks for you reply.

Actually, that’s what I am doing right now. But I want to make the
information that is passed from view to controller invisible to user.

I acutally do have one more form_remote_tag field, which is

<%= text_field_tag :channel_info ,@channel, {:size=>20} %>

But doing it this way, it’s visible and modifiable to and by user. (I
made diabled option turn on, then it wouldn’t let me pass the value in

Any other idea or suggestion?


coolJay wrote:

<%= text_field_tag :channel_info ,@channel, {:size=>20} %>

See hidden_field_tag.


Thank you for your help.

I am obviously a newbie to rails and web programing community as

Again Thanks~!


On 12¿ù28ÀÏ, ¿ÀÀü10½Ã40ºÐ, Robert H. [email protected]

On 12/27/07, coolJay [email protected] wrote:

Any other idea or suggestion?

Way back in HTML 2.0 they invented the hidden field tag:


In Rails it’s called hidden_field or hidden_field_tag depending on
your form setup:



Greg D.