Score:0

Placeholder is replaced with label text

cn flag

I am new in Drupal Community, I am trying to create a form using webform module in drupal 8, i have setup the placeholder for textfield but it won't show on the form, its taking label as placeholder. i have spent a lot of time to check the settings but unable to find such setting can any one help me to resolve this issue,

attaching screenshot of textfield setting and from:

enter image description here

enter image description here

please check above ss from your ref and help.

thanks in advanced.

my field.html.twig is:


{%
  set classes = [
    'field',
    'field--name-' ~ field_name|clean_class,
    'field--type-' ~ field_type|clean_class,
    'field--label-' ~ label_display,
    label_display == 'inline' ? 'clearfix',
  ]
%}
{%
  set title_classes = [
    'field__label',
    label_display == 'visually_hidden' ? 'visually-hidden',
  ]
%}

{% if label_hidden %}
  {% if multiple %}
    <div{{ attributes.addClass(classes, 'field__items') }}>
      {% for item in items %}
        <div{{ item.attributes.addClass('field__item') }}>{{ item.content }}</div>
      {% endfor %}
    </div>
  {% else %}
    {% for item in items %}
      <div{{ attributes.addClass(classes, 'field__item') }}>{{ item.content }}</div>
    {% endfor %}
  {% endif %}
{% else %}
  <div{{ attributes.addClass(classes) }}>
    <div{{ title_attributes.addClass(title_classes) }}>{{ label }}</div>
    {% if multiple %}
      <div class="field__items">
    {% endif %}
    {% for item in items %}
      <div{{ item.attributes.addClass('field__item') }}>{{ item.content }}</div>
    {% endfor %}
    {% if multiple %}
      </div>
    {% endif %}
  </div>
{% endif %}

Fons Vandamme avatar
de flag
Can you show the contents of the field.html.twig that renders this field? It might be possible that your theme prints the label as a placeholder in the twig file which overwrites the behaviour of webform?
cn flag
where we can find this file?
cn flag
i have found this at /core/themes/classy/templates/field/field.html.twig:
cn flag
updated question twig file.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.