Topic: How to manually set invalid select from html class?
IT_Santini pro premium priority asked a year ago
Expected behavior Can manually set invalid select from html class
Actual behavior Cannot invalid select from html class
Resources (screenshots, code snippets etc.) https://mdbootstrap.com/snippets/standard/it_santini/5794368
Kamila Pieńkowska staff answered 12 months ago
Please refer to section Validation in the docs to see how you can use validation in the select: https://mdbootstrap.com/docs/standard/forms/select/#section-validation
IT_Santini pro premium priority commented 12 months ago
I mean is how to set directly from html class or attribute, because I'm using php that create html element
Kamila Pieńkowska staff commented 12 months ago
This is the way to set the initial value: https://mdbootstrap.com/snippets/standard/kpienkowska/5822619
IT_Santini pro premium priority commented 10 months ago
What if I want to set manually without javascript? Because I'm implementing Laravel using MDBootstrap, validation happens on server, and on client side will get errors object from php, if using javascript it's a bit complicated and it's not practical for PHP application
Kamila Pieńkowska staff commented 10 months ago
Here id example i our docs: https://mdbootstrap.com/docs/standard/forms/validation/#section-server-side
IT_Santini pro premium priority commented 10 months ago
From your given example there is no input Select component
Mateusz Lazaru staff commented 10 months ago
it appears you'll need to use javascript to add .is-invalid
class manually.
IT_Santini pro premium priority commented 10 months ago
What about if we make this a feature request, because I think we need this to be implemented for server side request application without relying too much on javascript
Kamila Pieńkowska staff commented 10 months ago
We can discuss this with our team but if we decide to implement it it may take some time.
Kamila Pieńkowska staff commented 10 months ago
Until then you can set invalid state like this: https://mdbootstrap.com/snippets/standard/kpienkowska/5912093
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 6.4.2
- Device: Laptop
- Browser: Chrome
- OS: Win 11
- Provided sample code: No
- Provided link: Yes