question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Textfield and TextArea fields placeholder is not customizable

See original GitHub issue

Environment

Please provide as many details as you can:

  • Hosting type
    • [] Local deployment
      • Version:
  • Formio.js version: 4.13.10
  • Frontend framework: None
  • Browser: Chrome
  • Browser version: 104.0.5112.101

Steps to Reproduce

  1. Edit textfield component editForm
  2. Modify label placeholder to “Hello” for example

Expected behavior

in Form builder when you drag textfiled component, you should see “Hello” as a placeholder of label input

Observed behavior

textfield and textarea components display respectively “Text Field” and “Text Area” as default values not even as placeholders

Example

Screen Shot 2022-08-24 at 18 00 11

same issue for checkbox component too (and probably the rest of components)

Screen Shot 2022-08-24 at 18 26 04

Here is the code snippet for customizing the textfiled component editForm:


            Formio.Components.components.textarea.editForm = function () {
                return {
                    components: [
                        {
                            type: 'tabs', key: 'tabs',
                            components: [
                                {
                                    key: 'display', label: 'Weergave', weight: 0,
                                    components: [
                                        {type: 'textfield', key: "label", label: 'Label', placeholder: 'Label'},
                                        {type: 'input', key: 'placeholder', label: 'Placeholder'},
                                        descriptionComponent,
                                    ],
                                },
                                {
                                    key: 'validation', label: 'Validatie', weight: 10,
                                    components: [
                                        {type: 'checkbox', key: 'validate.required', label: 'Vereist'},
                                    ]
                                }
                            ],
                        },
                    ],
                };
            };

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:29 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
akhossanXcommented, Nov 6, 2022

Can we communicate in slack. I have few points to discuss??

Join me on discord @akhossan#3635

0reactions
akhossanXcommented, Nov 12, 2022

@PrathyushaModala No you are getting it wrong, I guess you have to take a look first at components customization in the documentation, Think of it is if we want to create a new custome component that is not offered by formio, in this case we need to define the schema, template (how the component UI looks like) and the editForm which is our matter here editForm is controlling the popup dialog UI when you drag the component to the editing area. the layout of that dialog is customized by defining a new function that returns an array of objects, each object is a field that is going to be edited inside the dialog. for example say we created a new custome component, and we call it mycustomfield , so the editForm of this new field is going to be customized the following way: Formio.Components.component.mycustomefield = function () { return { components: [ {type: "textfield", key: "label", label: "Label", placeholder: "my placeholder goes here"}, .... ] } } Now the problem appears in this level, the wording “my placeholder goes here” is not going to appear in the editForm, “Field input” or “Text Area” is what is going to be there instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML5 textarea placeholder not appearing - Stack Overflow
If you have an input in your form and placeholder is not showing because a white space at the beginning, this may be...
Read more >
bug(md-input) placeholder hidden underneath input with no ...
The placeholder is hidden behind the input element. Selecting the element triggers the ordinary animation, moving the placeholder above the ...
Read more >
Ability to add placeholder text in the bug_report_page.php
Asking if it's possible to make customized placeholder text that: ... once the user starts entering their information in said text field
Read more >
Don't Use The Placeholder Attribute - Smashing Magazine
When a person enters information into an input, its placeholder content will disappear. The only way to restore it is to remove the...
Read more >
Placeholders in Form Fields Are Harmful
If the placeholder remains in the field as editable text, users are forced to manually select and delete it.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found