views:

22

answers:

2

This week I have figured out how to modify form elements in the location module using form_alter and the custom element hook_elements() see: see http://stackoverflow.com/questions/2637052/need-some-tips-on-drupal-form-value

I was able to to hide elements using unset eg: unset($element['locpick']['user_latitude']); Also added css with drupal_add_css to hide unwanted groups, and change margins, borders & padding

However, I have a few questions - how can I add additional text header between fields? - how can I change input field length? - is it possible to move fields around or put them in a table?

reference: http://tinyurl.com/y6ugwtd

A: 

learn this: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6
1: set weight of two fields, for example, to 10 and 12. Add new "item" field with weight 11.
2: see "size" in top link.

Nikit
This approach seems very tedious. Can I somehow capture form values and create a new template with these values?
bert
It's recommended way...
Nikit
A: 

Also added css with drupal_add_css to hide unwanted groups

I highly advise against this. Use the Form API proper to control forms.

Kevin
I guess this would not be very transparent and could confuse administrator who may not aware of these operations in modules.
bert
Its the proper way to do it. If a form can't be changed in the permissions for a role then form_alter and other form hooks get the job done. You can't just hide fields with CSS- that immediately makes the forms inflexible, especially if future modules are relying on them.
Kevin