Try to describe it more clearly.

Let me give you an example scenario:

Model is user. Where you want to register multiple users in same form. 
Simple RHTML/HTML to display form and button to clone the form below. You 
can regenerate same html with javascript and name the text_field with index 
like this 
*HTML*
<div id='user_wrapper'>
<%= text_field_tag "user[0][name]" %>. 
</div>

Each time you clone the form increase index+1 in your javascript function. 
When you submit a form you will receive hash with all users details.

*js function would be like *
function clone_form(){
var count = parseInt($('count').value);
count = count+1;
$('count').value = count;
var fields = '<div id='user_wrapper'>
<input type="text" id= "user_'+count+'_name" name="user['+count+'][name]" 
</div> '
$('user_wrapper').insert(fields);
}

Hope this will help? 

On Sunday, February 9, 2014 2:43:42 AM UTC+5, Walter Lee Davis wrote:
>
> There is also the nested form setup, but your objects will need a common 
> parent. Can you sketch out your use-case, including any related models? 
> There may be a simple solution that your question doesn't trigger in those 
> of us who have read it. 
>
> Walter 
>
> On Feb 8, 2014, at 5:02 AM, Phillip wrote: 
>
> > The most direct way is to forget Rails and use HTML with or without 
> ActionView::Helpers::FormTagHelper. 
> > 
> > On Friday, February 7, 2014 5:24:46 PM UTC-5, Ruby-Forum.com User wrote: 
> > Hi, how can i register two rows of the same model in one form? 
> > 
> > -- 
> > 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 unsubscribe from this group and stop receiving emails from it, send 
> an email to [email protected] <javascript:>. 
> > To post to this group, send email to 
> > [email protected]<javascript:>. 
>
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/fbe1676e-8da9-46c3-a7d4-59fbc12215fa%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/groups/opt_out. 
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/68fc4f2e-f046-4813-aa12-d25e33a47fb0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to