Hello,

I've enabled Date PopUp module. Everything works fine with a new field type 'date_popup', but I get field look different from standard 'date' field. I just expect that those three combos are replaced with single edit that fires popup. That's all. Now I get additional label 'Date' (ok, I can remove it with '#date_label_position' => ''), unexpected one more 'description'. We do have possibility to set label and description in Form API. Why those extra objects are added in this control? Is here any simple way to keep the same style like standard form items or should I alter this form item from the code to remove extra label and extra description?

Thanx in advance
marukas

Comments

marukas’s picture

Uff, I've fixed this problem in css:

.container-popup-date.container-inline-date {
 	clear:none;
}

.container-popup-date > .form-item {
	margin: 1em 0;
}

.container-popup-date .date-padding {
 	margin: 0;
 	padding: 0;
}
 
.container-popup-date .date-padding .description, .container-popup-date .date-padding label {
	display:none;
}

You only must add class 'container-popup-date' to form item wrapper:

'#wrapper_attributes' => array('class' => array('container-popup-date')),

Greetings
marukas

Anandkumar’s picture

Thanks for the little css and php snippet! I did not know about the '#wrapper_attributes' render array element before :)

jomjom’s picture

Tnx

hem_awalker’s picture

If you want to remove the extra label, I found ['#date_label_position'] = 'none' seems to work

$form['filters']['startDate'] = array(
        '#type' => 'date_popup',
        '#date_format' => 'd/m/Y',
        '#title' => t('From Date:'),
        '#date_label_position' => 'none',
        '#datepicker_options' => array(
            'minDate' => $periodStartDate,
            'maxDate' => $periodEndDate,
            'yearRange' => "2001:+5",
        ),
        '#default_value' => $value_start,
ismail13’s picture

Thanks!