Topic: Implement MDB-Select server-side validation
IT_Santini
priority
asked 1 year ago
Expected behavior When server side validation return error on select field, it can add is-invalid class and display div class="invalid-feedback" with error message text below select input
Actual behavior When server side validation return error on select field, it cannot set styling with just adding is-invalid class or add div class="invalid-feedback" with error message text displayed
Resources (screenshots, code snippets etc.)
Michał Duszak
staff
answered 1 year ago
Here's a proper validation for Select: https://mdbootstrap.com/snippets/standard/m-duszak/3462979
https://mdbootstrap.com/docs/standard/forms/select/#section-validation
IT_Santini priority commented 1 year ago
From your example, validation happens at client side. What I'm trying to achieve is validation from server side. For Example: User cannot choose option two, but the validation check is done in server, not in client side How can I achieve this?
Michał Duszak staff commented 1 year ago
This is the provided validation for the select input MDB provides. It checks if select provides any option. If you wouldn't like user to provide certain options, you could disable them, or check their values on the server side, and then clear the select's value so that it will display invalid styles.
IT_Santini
priority
answered 1 year ago
https://mdbootstrap.com/snippets/standard/it_santini/3461531
here is the snippet of what i'm trying to achieve, should have error styling and message
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Priority
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 3.10.0
- Device: Laptop
- Browser: Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: No
Michał Duszak staff commented 1 year ago
Hello, how is your validation implemented? Could you show me a snippet which will reproduce this behaviour?