This is my form. It creates a comment in the database but won’t pass the
‘body’ value. I think the problem is passing the variable to javascript.
Can anyone help?
<% form_for :comment, :url=>story_comments_path(@story), :name =>
‘form’ do |form| %>
Comment:
<%= form.text_field :body %>
<%= link_to_remote('comment',{ :url =>
{:controller => 'comments' ,
:action => 'create',
:story_id => @story.id,
:method => 'get',
:with =>
'serialize_fields()' }}) %>
<% end %>
This is the javascript.
Neil B. wrote:
This is my form. It creates a comment in the database but won’t pass the
‘body’ value. I think the problem is passing the variable to javascript.
Can anyone help?
<% form_for :comment, :url=>story_comments_path(@story), :name =>
‘form’ do |form| %>
Comment:
<%= form.text_field :body %>
<%= link_to_remote('comment',{ :url =>
{:controller => 'comments' ,
:action => 'create',
:story_id => @story.id,
:method => 'get',
:with =>
'serialize_fields()' }}) %>
<% end %>
This is the javascript.
I tried this too
:with=>"‘body’ + $F(‘body’)"
That doesn’t work either. How can I pass this parameter?
On Jun 13, 12:50 pm, Neil B. [email protected] wrote:
This is my form. It creates a comment in the database but won’t pass the
‘body’ value. I think the problem is passing the variable to javascript.
Can anyone help?
Your serialize_form method looks borked. You could use the
remote_form_for method alternatively, prototype already provides a
serialise method for forms - $(‘id_of_the_form’).serialize() will
serialise all then inputs in the form
Fred
Dear Fred;
so thanks, for ur help.
am so new to ROR, and was so interested on AJAX,
i used the ActiveScaffod instead of it and all is okey.
bytheway, tnx2much
@};-
On Sun, Jun 13, 2010 at 8:12 PM, Frederick C. <
[email protected]> wrote:
serialise method for forms - $(‘id_of_the_form’).serialize() will
<% form_for :comment, :url=>story_comments_path(@story), :name =>
‘serialize_fields()’ }}) %>
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.