On Oct 26, 2011, at 11:53 AM, JavierQQ wrote:

Hello,

I'm having some trouble with forms, my app allows to enter data by
using a multi-step form that has 7 steps.
There are 3 steps that may let the user to add 1 form, for example
there's a step called "children"
and that children has the following fields:
 * name
 * age
 * gender
but one father may have more than 1 child and I'm adding another form
with ajax by following this
http://stackoverflow.com/questions/4812003/adding-fields-dynamically-in-a-nested-model-form-in-rails-3

in the "invite" partial
_invite.html.erb
<%= fields_for "user[invites_attributes][]", invite do |i| %>
 <li>
   <%= link_to("Remove", "#delete", :class => "delete-invite") %>
   <%= i.label :full_name, "Full Name" %>
   <%= i.text_field :full_name %>
   <%= i.label :email, "Email Address" %>
   <%= i.text_field :email %>
 </li>
<% end %>

I'm having some troubles with the first line: <%= fields_for
"user[invites_attributes][]", invite do |i| %>
What is the correct usage of that? I'm using formtastic and when I
made that line but with my fields

    <%= f.semantic_fields_for ("user[children_attributes][]", user)
do |fes| %>

and I get this error

 ...............  unexpected ',', expecting ')'

I hope someone can help

Thanks in advance


I think that the space after f.semantic_fields_for and the parentheses around the argument list are interacting to produce the error.

I think that you can probably do either fix and resolve the issue:

<%= f.semantic_fields_for "user[children_attributes][]", user do | fes| %>

<%= f.semantic_fields_for("user[children_attributes][]", user) do |fes| %>

-Rob

Rob Biedenharn          
[email protected]     http://AgileConsultingLLC.com/
[email protected]               http://GaslightSoftware.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