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 Cheung <
[email protected]> wrote:

>
>
> On Jun 13, 12:50 pm, Neil Bye <[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
>
>
>
>
>
>
>
> >  <% 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 viahttp://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]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
Regards,
AliRezaTaleghani.
0936 322 4069

-- 
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