Topic: CheckBox required not work
AlexEneni pro asked 6 years ago
Hi!
Today I tryed to use default chrome required for checkbox.
It doesn't work!
HTML:
<input type="checkbox" value="1" class="form-check-input" required>
Error:
An invalid form control with name=' ' is not focusable.
I know i can write my own required alert, but i want to use default.
what i can do to fix it?
regards
Josip Tomašev priority answered 6 years ago
Hi,
In fact, the problem is with this css:
[type = radio], [type = check box] { Position: Absolute; left: -9999px; visibility: hidden; }Attribute "Visibility: Hidden;" prevent focusing check box and because of this error appears in the log. If you set "Visibility: visible;", error is not displayed in error log, but also error that field is required is not visible, because of attribute 'left', whitch is out of screen. On the other hand, form works properly, and form will not be submitted if check box is not checked, without any visible error. (And, of course, form will be submitet if check box is checked.) Solution is to use some JS validation to show error on page, to user can know where is the problem. Regards Josip
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Answered
Specification of the issue
- ForumUser: Pro
- Premium support: No
- Technology: MDB jQuery
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: Yes
- Provided link: No
Tags
Bartłomiej Malanowski staff commented 6 years ago
Did you try the same with the latest version of MDB?AlexEneni pro commented 6 years ago
i readed that problem is with bootstrap. normally checkbox work correctly, with clear bootstrap not, with this bootstrap (MDB) not.