It looks like you're new here. If you want to get involved, click one of these buttons!
Hi
I have an advanced module where I want multiple forms on a single page.
I have this working however only the supercomboselect on the first form is being initialised. On the second form, I see the standard HTML multi-select format.
What am I missing?
Controller:
$form1fields['f1field'] = array('type' => 'multi', 'label'=>'Species', 'options' => my_options_list_a());
$this->form_builder->set_fields($form1fields);
$vars['form1'] = $this->form_builder->render();
$form2fields['f2field'] = array('type' => 'multi', 'label'=>'Species', 'options' => my_options_list_b());
$this->form_builder->set_fields($form2fields);
$vars['form2'] = $this->form_builder->render();
$this->fuel->admin->render('_admin/main', $vars, Fuel_admin::DISPLAY_DEFAULT);
View:
echo $form1;
echo $form2;
Comments
That one is tough to tell without the full controller code. One issue may be that the main page area in FUEL is surrounded by a form tag and doesn't allow nesting multiple form tags which may be part of the issue depending on how you setup the page.
For each render, is it outputting a chunk of javascript similar to below (do a search for "formBuilderFuncs" in the source)?
Yeah. There's a form element wrapping everything, the "correct"(?) [div] container for the first form and then a [form] container for the 2nd form. There's two formBuildFuncs stanzas but both use the ID of the first form.
Loading the formbuilder library in the controller and building 2 forms doesn't seem to create two separate sets of form code.
Is there a way to set up a view page that doesn't include that wrapping form?
I might need to rearrange the way I'm presenting this module - separate pages for each form and a collective menu on the left-hand side...
You can set the id on the second form so that it renders with a different ID:
Thanks. Setting $this->form_builder->id was enough to get things working.