I'm writing my first module. And in the form drupal adds form-item form-type- for every item.
I was looking for a solution and find out this solution from stackoverflow
Couldn't understand much from api page
The answer works fine for one input item not for entire form.
So, if I don't want any wrapper at all, how could I remove them?

Comments

Jaypan’s picture

To what end?

DAKSH’s picture

For every select, input box, drupal is adding div class="form-item form-type-select form-item-chartSize"
I would would prefer to have no div class wrapper at all.

Jaypan’s picture

I understand that. I just don't understand why.

You can probably loop through every form element in a form_alter hook, and remove them there.

DAKSH’s picture

I found a work around mostly.
If I use $form['email']['#theme_wrappers'] = array(); for each item separately, I'm able to remove wrappers mostly except radio.
I'm trying to use Jqueryui Radiobuttonset without using any additional module.
For Radio my module code is

//Date Selector
    $form['dateselect'] = array(
    '#type' => 'radios',
    '#options' => array('fixed'=>t('Fixed Date'),'custom'=>t('Custom Date')),
        
);

However drupal is producing wrappers for each options and using $form['email']['#theme_wrappers'] = array() isn't helping in case of radio.
Html looks like:

<div class="form-item form-type-radio form-item-dateselect">
<input id="edit-dateselect-fixed" class="form-radio" name="dateselect" value="fixed" type="radio">
<label class="option" for="edit-dateselect-fixed">Fixed Date </label>
</div>
<div class="form-item form-type-radio form-item-dateselect">
<input id="edit-dateselect-custom" class="form-radio" name="dateselect" value="custom" type="radio">
<label class="option" for="edit-dateselect-custom">Custom Date </label>
</div>

Any suggestion on it?