I have a form with multiple tabs like so:
arg = {id: @id}
= form_tag({ action: "update_list" }.merge(arg), method: put)
.form-group
ul.nav.nav-tabs
-for k,v in @list
li.nav-item class="active"
a.nav-link data-toggle="tab" href="##{k}" #{v}
div class="tab-content"
- for name in @list
div id="#{name}" class="tab-pane fade in active"
textarea.form-control name= test
It can be seen that the form encapsulates multiple tabs and each tab has a text area and upon submitting of the form, a put request is sent with an id being used as an argument. However, each of the text areas have different ids. usually on submitting a form like this, a put request could be sent for all the tabs under one endpoint and a single argument could be used for that call. How would it work however if that argument is different for each tab? in this case, each textbox has its own unique id so multiple put requests would need to be sent to differing endpoints to submit all the tabs. How would I go about achieving this? essentially the argument being used for the form would be different for each tab.
I'm not really a slim expert, as I'm used to haml.
you'll need to define
@idsin your controller. this creates a new form for each id, so that each form has a text_area in it with the nametest. you might want to tweak this to put the id into the textarea name.