By flighingman on
Hello,
How to add a field in the middle of a form thanks to the personal drupal module.
With following instruction, the field is added at the end:
$form['action']=array(
'#type'=>'checkbox',
);
Return $form;
Hello,
How to add a field in the middle of a form thanks to the personal drupal module.
With following instruction, the field is added at the end:
$form['action']=array(
'#type'=>'checkbox',
);
Return $form;
Comments
I assume, you are adding the
I assume, you are adding the new field in hook_form_alter(). When a new field will be added then it will automatically added at the last of field. You can use "#weight" attribute to reorder the field.
Alternatively, you can get it done through JQuery. append(), prepend (), insertAfter(), InsertBefore() could be useful.