Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am sure this is something to do with how i am inserting this field; but don't see it.
i am trying to add a simple date picker field to a custom form.
i made a function:
function room_reservations_admin_date_picker($form_state) {
$form['date'] = array(
'#type' => 'date_popup',
'#description' => t('my custom description text'),
'#title' => 'my custom title',
'#default_value' => date('Y-m-d'),
'#date_type' => DATE_DATETIME,
'#date_timezone' => date_default_timezone(),
'#date_format' => 'Y-m-d',
'#date_increment' => 1,
'#date_year_range' => '-0:+1',
);
return $form;
}
and then i simply embedded this in to the rest of my html:
$output .= drupal_render(drupal_get_form('room_reservations_admin_date_picker'));
it works fine except that my title and desc do not replace the default ones that show up: http://screencast.com/t/UCIglxwD
do i need to hide these with CSS or is there something i am missing here?
Comments
Comment #1
liquidcms CreditAttribution: liquidcms commentedi added an after_build function to do this:
not sure if this is best method or not.
Comment #2
rutger.gabriel CreditAttribution: rutger.gabriel commentedHaving the same issue here, when changing the Date field's helptext through configuration, the default helptext keeps showing up instead of my custom text. I also used a custom 'after_build' function to change that. It's not the most ideal way but providing the helptext is a big deal in my project.
Comment #3
apaderno