I would like to change the help text for an input field. My form ID is views-exposed-form-events-page-1
. I have a text field that I want the helpful hint to appear below. The field ID is edit-field-event-date-value2
, I think, based on the htmlHTML.
<div id="edit-field-event-date-value2-wrapper" class="views-exposed-widget views-widget-filter-field_event_date_value2">
<label for="edit-field-event-date-value2">
From </label>
<div class="views-widget">
<div id="edit-field-event-date-value2-value-wrapper">
<div id="edit-field-event-date-value2-value-inside-wrapper">
<div class="container-inline-date"><div class="form-item form-item-field-event-date-value2-value form-type-date-popup form-group">
<div id="edit-field-event-date-value2-value" class="date-padding"><div class="form-item form-item-field-event-date-value2-value-date form-type-textfield form-group">
<input class="form-control form-text" type="text" id="edit-field-event-date-value2-value-datepicker-popup-0" name="field_event_date_value2[value][date]" value="18/12/2019" size="20" maxlength="30" />
<label class="control-label element-invisible" for="edit-field-event-date-value2-value-datepicker-popup-0">Date</label>
<div class="help-block"> E.g., 18/12/2019</div>
I thought that this would work, but I'm not seeing any help text appearing under the form field.
function mytheme_form_views_exposed_form_events_page_1_alter(&$form, &$form_state, $form_id) {
$form['edit-field-event-date-value2']['#attributes']['description'] = 'DD/MM/YYYY';
}
What am I doing wrong?