As designed Custom fields: required html attribute not working for checkboxes

Scandal

Well-known member
Affected version
2.2.9
Hello all!

I have detected an issue on xF 2.2.9 custom thread fields system.

More specifically, for any field type which is marked as Required and not completed on the form, browser (example: Chrome), returns a message and not allowed to submit the thread:
textbox_required.webp

... except the checkboxes custom thread field.
For example this:
checkboxes_required.webp

It is required, it has no checked values, but the browser allows to submit the form.
Of course there is the back-end check which gives an error popup to complete this field.

Is there any way to fix the issue so as to not able to submit the form and display the Please fill out this field, box, also for checkboxes?
 
Requiring one of multiple checkboxes in a group to be selected is not possible with plain HTML.

So without some JS trickery (like making all checkboxes in a group required and un-require all except selected ones upon change of selection) the only option is to check this on the server side.

But even if this is done it's not without drawbacks - the message would be attached to one of the checkboxes and indicate that this checkbox must be selected (which is not correct and could mislead the user).
 
For the reasons mentioned, this is really just working as designed. We have to do server side validation here.
 
Back
Top Bottom