Skip to main content
edited body
Source Link
user72672
user72672

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?

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 html.

<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?

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 HTML.

<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?

Removed Drupal 7 from title
Source Link
leymannx
  • 18.8k
  • 6
  • 72
  • 126

Drupal 7 How do you add help text to a form item?

I would like to change the help text offor an input field. My form idID is views-exposed-form-events-page-1views-exposed-form-events-page-1. I have a text field that I want the helpful hint to appear below. The field idID is edit-field-event-date-value2edit-field-event-date-value2, I think, based on the html.

<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';
}

I'm not sure where IWhat am goingI doing wrong.?

Drupal 7 add help text to a form item

I would like to change the help text of 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 html.

<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';
}

I'm not sure where I am going wrong.

How do you add help text to a form item?

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 html.

<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?

Source Link
MrFox
  • 137
  • 7

Drupal 7 add help text to a form item

I would like to change the help text of 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 html.

<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';
}

I'm not sure where I am going wrong.