coolJay
1
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
…
end
coolJay
2
You’re already doing it. you just just add more fields to the form
depending
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.
coolJay
3
Ryan,
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
it)
Any other idea or suggestion?
Thanks~!
coolJay
4
coolJay wrote:
<%= text_field_tag :channel_info ,@channel, {:size=>20} %>
See hidden_field_tag.
http://api.rubyonrails.com/classes/ActionView/Helpers/FormTagHelper.html#M001039
coolJay
5
Robert,
Thank you for your help.
I am obviously a newbie to rails and web programing community as
well…
Again Thanks~!
Jay
On 12¿ù28ÀÏ, ¿ÀÀü10½Ã40ºÐ, Robert H. [email protected]
coolJay
6