Description Text Display Issue in Webform Fieldset Fields

Created on 6 March 2024, 10 months ago
Updated 15 April 2024, 8 months ago

Problem/Motivation

I've encountered an issue with the Webform module in Drupal 10 where setting the description text to display before or after a field within a fieldset is not working as expected.

Steps to reproduce

  1. Install and enable the updated webform module in Drupal 10 updated version.
  2. Create a new webform or edit an existing one.
  3. Add a fieldset to the webform.
  4. Add a field within the fieldset.
  5. Set the description text of the fieldset to display either before or after the field.
  6. Save the webform and view it on the front end.

Proposed resolution

The description text should display either before or after the field within the fieldset element according to the selected option.

Actual Behaviour

The description text does not display in the specified position within the fieldset and appears inconsistently.

πŸ› Bug report
Status

Closed: cannot reproduce

Version

6.2

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Ponnarasi Marimuthu
  • Status changed to Postponed: needs info 10 months ago
  • Please provide the YAML of a simple form that reproduces the bug and also add to the steps to reproduce the Drupal theme that is required to show the bug.

  • Hi cilefen,

    Here is the YAML structure of the form where I am facing the issue. Its happening on all webforms. I have downgraded the webform module to beta version. In the beta version the issue is not occurring.

    uuid: 5e7c80c2-6c43-48cb-9724-5e9d68fdfc61
    langcode: en
    status: open
    dependencies: { }
    weight: 0
    open: null
    close: null
    uid: 6
    template: false
    archive: false
    id: city_swag_donation_request
    title: 'City Swag Donation Request'
    description: ''
    categories: { }
    elements: |-
    notice:
    '#type': webform_markup
    '#markup': 'Upon confirmation/approval, a member of our team will be in touch with the contact provide.'
    flexbox_01:
    '#type': webform_flexbox
    please_write_your_information_below:
    '#type': fieldset
    '#title': 'Your Contact Information'
    '#description': '

    Contact information

    '
    '#description_display': before
    name:
    '#type': textfield
    '#title': 'First and Last Name*'
    '#required': true
    '#format_items': comma
    phone:
    '#type': tel
    '#title': 'Your Phone*'
    '#required': true
    '#pattern': '^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$'
    '#pattern_error': 'Please enter correct phone number.'
    '#format_items': comma
    email:
    '#type': email
    '#title': 'Your Email*'
    '#required': true
    '#format_items': comma
    what_is_your_role_in_the_organization_:
    '#type': textfield
    '#title': 'What is your role in the organization?*'
    '#required': true
    '#format_items': comma
    please_write_the_nominee_s_information_below:
    '#type': fieldset
    '#title': 'Organization Information'
    '#description_display': before
    nominee_email:
    '#type': textfield
    '#title': 'Name of Organization/Individual making the request*'
    '#required': true
    '#format_items': comma
    team_name_athletics_organizations_only_:
    '#type': textfield
    '#title': 'Team Name (athletics organizations, only)'
    '#format_items': comma
    nominee_name:
    '#type': textfield
    '#title': 'Address*'
    '#required': true
    '#format_items': comma
    nominee_address:
    '#type': textfield
    '#title': 'City*'
    '#required': true
    '#format_items': comma
    state:
    '#type': select
    '#title': 'State*'
    '#options': state_names
    '#empty_option': Select
    '#required': true
    '#default_value': California
    nominee_phone:
    '#type': textfield
    '#title': 'Zip Code*'
    '#required': true
    '#format_items': comma
    organization_website_or_social_media_link:
    '#type': textfield
    '#title': 'Organization website or social media link*'
    '#required': true
    '#format_items': comma
    are_you_a_501_c_3_organization_:
    '#type': radios
    '#title': 'Are you a 501(c)(3) organization?'
    '#description_display': before
    '#options':
    'Yes': 'Yes'
    'No': 'No'
    '#required': true
    what_kind_of_organization_is_it_:
    '#type': textfield
    '#title': 'What kind of organization is it?'
    '#description': 'What kind of organization is it?*'
    '#description_display': before
    '#required': true
    '#states':
    visible:
    ':input[name="are_you_a_501_c_3_organization_"]':
    value: 'No'
    '#format_items': comma
    flexbox:
    '#type': webform_flexbox
    statement:
    '#type': fieldset
    '#title': 'Event Information'
    '#description_display': before
    date_of_event:
    '#type': date
    '#title': 'Date of Event*'
    '#description': 'Date of Event'
    '#description_display': before
    '#required': true
    '#format_items': comma
    name_of_event:
    '#type': textfield
    '#title': 'Name of Event*'
    '#required': true
    '#format_items': comma
    brief_description_of_event_:
    '#type': textarea
    '#title': 'Description of Event*'
    '#description_display': before
    '#format_items': comma
    donation_request:
    '#type': fieldset
    '#title': 'Donation Request'
    '#description_display': before
    number_of_items_needed:
    '#type': textfield
    '#title': 'Number of Items Needed*'
    '#required': true
    '#format_items': comma
    type_of_donation_desired:
    '#type': textfield
    '#title': 'Type of donation desired*'
    '#description': 'Items selected are at the discretion of the City, quantities are limited, and not all requests may be approved.'
    '#description_display': after
    '#required': true
    '#format_items': comma
    additional_details_reason:
    '#type': textarea
    '#title': 'Additional Details/Reason'
    '#description': '(Please identify the purpose for the request, how they will be distributed, to whom the items will be gifted and other pertinent details for consideration)'
    '#description_display': after
    '#format_items': comma
    what_are_the_age_groups_of_the_recipients_:
    '#type': checkboxes
    '#title': 'What are the age groups of the recipients?'
    '#description_display': before
    '#options':
    'Children (0-7)': 'Children (0-7)'
    'Youth (8-12)': 'Youth (8-12)'
    'Teens (13-18)': 'Teens (13-18)'
    'Adult (18+)': 'Adult (18+)'
    '#required': true
    when_do_you_need_to_receive_the_items_:
    '#type': date
    '#title': 'When do you need to receive the items?*'
    '#description': |-
    When do you need to receive the items?
    (Item delivery date must be at least one week prior to scheduled event/in-hand date.)
    '#description_display': before
    '#required': true
    '#format_items': comma
    '#date_date_min': '+1 weeks'
    '#date_days':
    - '1'
    - '2'
    - '3'
    - '4'
    - '5'
    captcha:
    '#type': captcha
    css: ''
    javascript: ''
    settings:
    ajax: false
    ajax_scroll_top: form
    ajax_progress_type: ''
    ajax_effect: ''
    ajax_speed: null
    page: true
    page_submit_path: ''
    page_confirm_path: ''
    page_theme_name: ''
    form_title: both
    form_submit_once: false
    form_open_message: ''
    form_close_message: ''
    form_exception_message: ''
    form_previous_submissions: false
    form_confidential: false
    form_confidential_message: ''
    form_disable_remote_addr: false
    form_convert_anonymous: false
    form_prepopulate: false
    form_prepopulate_source_entity: false
    form_prepopulate_source_entity_required: false
    form_prepopulate_source_entity_type: ''
    form_unsaved: false
    form_disable_back: false
    form_submit_back: false
    form_disable_autocomplete: false
    form_novalidate: false
    form_disable_inline_errors: false
    form_required: false
    form_autofocus: false
    form_details_toggle: false
    form_reset: false
    form_access_denied: default
    form_access_denied_title: ''
    form_access_denied_message: ''
    form_access_denied_attributes: { }
    form_file_limit: ''
    form_attributes: { }
    form_method: ''
    form_action: ''
    share: false
    share_node: false
    share_theme_name: ''
    share_title: true
    share_page_body_attributes: { }
    submission_label: ''
    submission_exception_message: ''
    submission_locked_message: ''
    submission_log: false
    submission_excluded_elements: { }
    submission_exclude_empty: false
    submission_exclude_empty_checkbox: false
    submission_views: { }
    submission_views_replace: { }
    submission_user_columns: { }
    submission_user_duplicate: false
    submission_access_denied: default
    submission_access_denied_title: ''
    submission_access_denied_message: ''
    submission_access_denied_attributes: { }
    previous_submission_message: ''
    previous_submissions_message: ''
    autofill: false
    autofill_message: ''
    autofill_excluded_elements: { }
    wizard_progress_bar: true
    wizard_progress_pages: false
    wizard_progress_percentage: false
    wizard_progress_link: false
    wizard_progress_states: false
    wizard_start_label: ''
    wizard_preview_link: false
    wizard_confirmation: true
    wizard_confirmation_label: ''
    wizard_auto_forward: true
    wizard_auto_forward_hide_next_button: false
    wizard_keyboard: true
    wizard_track: ''
    wizard_prev_button_label: ''
    wizard_next_button_label: ''
    wizard_toggle: false
    wizard_toggle_show_label: ''
    wizard_toggle_hide_label: ''
    wizard_page_type: container
    wizard_page_title_tag: h2
    preview: 0
    preview_label: ''
    preview_title: ''
    preview_message: ''
    preview_attributes: { }
    preview_excluded_elements: { }
    preview_exclude_empty: true
    preview_exclude_empty_checkbox: false
    draft: none
    draft_multiple: false
    draft_auto_save: false
    draft_saved_message: ''
    draft_loaded_message: ''
    draft_pending_single_message: ''
    draft_pending_multiple_message: ''
    confirmation_type: inline
    confirmation_url: ''
    confirmation_title: ''
    confirmation_message: "

    Thank you for your request

    \r\nWe will follow up with you shortly."
    confirmation_attributes: { }
    confirmation_back: true
    confirmation_back_label: ''
    confirmation_back_attributes: { }
    confirmation_exclude_query: false
    confirmation_exclude_token: false
    confirmation_update: false
    limit_total: null
    limit_total_interval: null
    limit_total_message: ''
    limit_total_unique: false
    limit_user: null
    limit_user_interval: null
    limit_user_message: ''
    limit_user_unique: false
    entity_limit_total: null
    entity_limit_total_interval: null
    entity_limit_user: null
    entity_limit_user_interval: null
    purge: none
    purge_days: null
    results_disabled: false
    results_disabled_ignore: false
    results_customize: false
    token_view: false
    token_update: false
    token_delete: false
    serial_disabled: false
    access:
    create:
    roles:
    - anonymous
    - authenticated
    users: { }
    permissions: { }
    view_any:
    roles:
    - events
    users: { }
    permissions: { }
    update_any:
    roles:
    - events
    users: { }
    permissions: { }
    delete_any:
    roles:
    - events
    users: { }
    permissions: { }
    purge_any:
    roles:
    - events
    users: { }
    permissions: { }
    view_own:
    roles: { }
    users: { }
    permissions: { }
    update_own:
    roles: { }
    users: { }
    permissions: { }
    delete_own:
    roles: { }
    users: { }
    permissions: { }
    administer:
    roles: { }
    users: { }
    permissions: { }
    test:
    roles:
    - events
    users: { }
    permissions: { }
    configuration:
    roles: { }
    users: { }
    permissions: { }
    handlers:
    above_and_beyond_submission:
    id: email
    handler_id: above_and_beyond_submission
    label: 'City Swag Donation Request'
    notes: ''
    status: true
    conditions: { }
    weight: 0
    settings:
    states:
    - completed
    to_mail: jsolario@elkgrovecity.org
    to_options: { }
    bcc_mail: clumry@elkgrovecity.org
    bcc_options: { }
    cc_mail: ''
    cc_options: { }
    from_mail: noreply@elkgrovecity.org
    from_options: { }
    from_name: _default
    reply_to: ''
    return_path: ''
    sender_mail: ''
    sender_name: ''
    subject: 'Someone has requested a swag donation'
    body: _default
    excluded_elements: { }
    ignore_access: false
    exclude_empty: true
    exclude_empty_checkbox: false
    exclude_attachments: false
    html: true
    attachments: false
    twig: false
    theme_name: ''
    parameters: { }
    debug: false
    variants: { }

  • Status changed to Closed: cannot reproduce 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    I can't replicate this issue with the attached webform via the Olivero theme.

    β†’

    The issue is most likely related to your theme and the fieldset.html.twig template not being up-to-date.

  • Hi jrockowitz,

    Thankyou for providing the details. As you said, the mistake was in my theme and I have now updated the fieldset.html.twig file. Now the fieldset description display is working as expected. Thanks for the support.

Production build 0.71.5 2024