mplodowski / formbuilder-plugin-public

https://octobercms.com/plugin/renatio-formbuilder
https://octobercms.com/plugin/renatio-formbuilder
2 stars 0 forks source link

Placeholder in textarea not showing #10

Closed ibrain90 closed 2 years ago

ibrain90 commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Add field with textarea type
  2. Fill placeholder and name. Default value leave blank
  3. Open page with form
  4. Placeholder in textarea not showing

Expected behavior Expect display placeholder in textarea.

Screenshots If applicable, add screenshots to help explain your problem.

October version 2.1.26

Plugin version 2.1.6

Additional context Placeholder not show because textarea not empty and contain 18 spaces although default falue is empty. If set default value, value display in textarea without any spaces. I tryed duplicate textarea text field and remove all twig variables from textarea in template. Problem continue reproducing. But when I add textarea element to a page no one spaces in textarea and placeholder desplaying.

mplodowski commented 2 years ago

Do you use standard component on page or do you use Raw fields markup?

I tested form with default textarea markup and use standard component on the CMS page and placeholder works correctly.

I tested form with default textarea markup and used raw fields markup and still placeholder works.

So I assume you changed default markup in some way or use raw fields markup.

Probably the issue is that you have white space in textarea content. You cannot have any line breaks or spaces between opening and closing textarea tag.

Something like this will produce the error you have:

<textarea>

</textarea>

This example will not show placeholder, because it has line breaks inside tags.

<textarea placeholder="Test">

</textarea>

This is correct, it will show placeholder.

<textarea placeholder="Test"></textarea>

Here is similar issue: https://stackoverflow.com/questions/2202999/why-is-textarea-filled-with-mysterious-white-spaces

I recommend you to not use Raw Fields Markup if you don't know HTML well. The better approach if you need to customize field markup is to clone field type and customize it there.