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| %>
  <fieldset>
       <label for="login">Comment:</label>
       <div id="body"><%= form.text_field :body %></div>
       <%= link_to_remote('comment',{ :url    =>
                                         {:controller => 'comments' ,
                                          :action => 'create',
                                          :story_id => @story.id,
                                          :method => 'get',
                                          :with   =>
'serialize_fields()' }}) %>
    </fieldset>
  <% end %>

This is the javascript.

<script>
function serialize_fields(){
  var fields = new Array();
  fields.push(Form.Element.serialize('document.form.body'));
  return fields.join('&');
}
</script>
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to