Topic: validation select
Randall.eikelboom free asked 3 years ago
if one of the options is 'selected' when page is loaded, the placeholder is still being shown ... can this be changed to show the 'selected' option instead of the placeholder?
also, can you provide some guidance when using two or more select on the same form
In your example label is not visible on page load due to a dynamically added placeholder, which covers the label. You can fix that in a few ways. The recommended solution from our documentation for that component is to use the
disabled active option which will represent your placeholder when no option is selected. Another way, but less recommended is to explicitly add an
active class to the label, which will make it visible.
Please see my snippet that shows your issue and possible solutions: https://mdbootstrap.com/snippets/jquery/marcin-luczak/2713040
Thanks Marcin, working great! Quick question, when using with a select label, the label doesn't display when the page is loaded and the value is "". Only after the field is click is it displayed. If there is a value, the label is displayed without issues. Is there any guidance to display the label when the page is loaded and there is no value?
The selected option in your form is not visible on page load because it has been overridden by
You can handle 2 or more selects basically by adding another select to your form. This should create two separate instances of the select component.
For both questions please see my snippet based on your code: https://mdbootstrap.com/snippets/jquery/marcin-luczak/2705565
Also, can you provide some guidance if using 2 or more selects within the same form
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.17.0
- Device: PC
- Browser: Safari
- OS: OS Catalina
- Provided sample code: No
- Provided link: No