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.

Form.Select - placeholder disappearing

See original GitHub issue

I want select list where I can select null value

When I choose item from the list, placeholder disappearing

                    <Form.Select
                        name="parentId"
                        value={this.state.parentId}
                        options={options}
                        onChange={this.handleChange.bind(this)}
                        placeholder='Parent Id'
                    />

When I trying add extra item with empty value, it’s not set as default.

            options.push({
                'key': '1',
                'text': 'Parent Id',
                'value': ''
            })

How to make placeholder presist or set empty value as default?

Version

0.71.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
layershiftercommented, Aug 25, 2017

but your example doesn’t work

Yep, I’ve forgot to add onChange handler.

By the way, why I need separate button to clear select?

How you want to reset value in another way? 🙃 Something should change the state.

I’ve copied behaviour to icon on Dropdown, so it resets value as in your example. However, it needs more styling and more logic because it’s not a SUI feature. See codepen.

If you preventing applying null value

handleReset sets value to null. '' don’t accepted as value, there is already issue about this #1748. placeholder behaviour is also was discussed there #1299. Contributions are welcome.

0reactions
rafalradomskicommented, Aug 25, 2017

@layershifter thx, but your example doesn’t work, when you select option, reset and try select again it doesn’t work

By the way, why I need separate button to clear select? it’s bad UI, normal select can handle both cases

If you preventing applying null value, you should provide some solution to easily reset select list with out some extra UI elements…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue.js select placeholder disappears on input click
When I click ANY other input on the page, the select placeholders dissappear and they look like empty fields. If you click the...
Read more >
Placeholder not disappearing after selection - WordPress.org
I'm currently using the Multiple Choice input field for my form, but for some reason, the placeholder won't disappear after selecting an option....
Read more >
Dynamic Control added to PlaceHolder disappears on button ...
Hello Friends, I have a dropdown on page, a place holder and a save button on my form. Now, I am creating a...
Read more >
:placeholder-shown - CSS: Cascading Style Sheets | MDN
The :placeholder-shown CSS pseudo-class represents any or element that is currently displaying placeholder text.
Read more >
Mdb Select Form reset replaces placeholder to empty value
When we change value of selectbox (select a value) from HTML and then reset the value Then place holder disappears. Add comment. Arkadiusz...
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