By derMatze on
Hey!
I'd like to have multiple forms on a single page. But in the form_state there's always just the information from the first form on the page.
I've got a small form function:
function module_form($form, &$form_state, $file) {
$form[$file]['file'] = array(
'#type' => 'textfield',
'#value' => $file,
'#title' => 'file',
);
$form[$file]['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}
This function is called from another function like this:
...
foreach($files as $file) {
$form = drupal_get_form('module_form', $file->uri);
$output .= render($form);
}
...
What am I doing wrong?
Comments
Each form has to have a
Each form has to have a unique id, see hook_form().
Though I wonder why you do not simply use a single form that supports multiple fields.
So I would have to have one
hook_forms is the solution, thanks!
I do have a lot (hundreds) of elements (= forms) on that one page. I don't want the user to send them all everytime one item is updated.
Can you post a working
Can you post a working example ?
I'm trying to get this, multiple forms of one content type, "saldo_dias_feriado", on one page ... no luck
what I've done is also on this question, I resume
at hook_menu()
at saldos_dias_feriado_form.inc
and at pezgordo.module()
but this, and some other attempts with subtle variants doesn't ork for me, results vary from:
please help ! , thanks