ruby on rails - Submitting an array in a form -
i've been reading question (ruby on rails: submitting array in form) didn't answer question.
i have form:
<div class="signup pull-right"> <div> <p style="color: white">create doctor:</p> <%= form_for(@doctor) |d| %> <%= d.text_field :name[1], :placeholder => "name" %> <%= d.text_field :name[2], :placeholder => "surname" %> <%= d.text_field :email, :placeholder => "email" %> <%= d.text_field :password, :placeholder => "password" %> <%= d.text_field :password_confirmation, :placeholder => "password confirmation" %> <%= d.submit "sumbit", class: "btn btn-small btn-primary pull-right", id: "boton" %> <% end %> </div>
where name array. want catch name , surname separately , join them inside name[]. couldn't found way easily. have suggestion?
thanks in advance.
i check till have html generated:
<input name='doctor[name][]'>
i try:
<%= text_field_tag 'doctor[name][]' %>
Comments
Post a Comment