Log message #4125160

# At Username Text
# Mar 14th 2018, 18:12 alexmax ``` $this->Form->select('pubs', ['x' => 'X', 'y' => 'Y', 'z' => 'Z', ], [ 'multiple' => 'checkbox', ]); ```
# Mar 14th 2018, 18:10 alexmax I bet my old version of CakePHP 3.2.9 might be the cause of some of these problems.
# Mar 14th 2018, 18:09 alexmax Great, `multiple => checkbox` doesn't render any checkboxes to the page, only the containing divs.
# Mar 14th 2018, 18:00 meder i need to cache on a condition - can i just return false in a lambda fed to ->cache?
# Mar 14th 2018, 17:56 alexmax I can validate each individual entry, but I have no way to validate all of the fields as a whole because the error has nowhere to go
# Mar 14th 2018, 17:56 alexmax Ugh, and if I break each selection out into its own checkbox, I now don't have a place to put validation for all five of the checkboxes
# Mar 14th 2018, 17:51 alexmax I have a bunch of checkboxes that I want to have validation over all of them "at least one", which seems like multiselect checkbox would be perfect for. However, some of these checkboxes need a little smidgen of content after the label.
# Mar 14th 2018, 17:50 alexmax Is it possible to pass per-item templateVars to a checkbox multiselect?
# Mar 14th 2018, 17:50 alexmax Hrm
# Mar 14th 2018, 17:18 alexmax I might just novalidate the form
# Mar 14th 2018, 17:17 sssd validation*
# Mar 14th 2018, 17:17 sssd can try reportValidity() also to manully run html5 validaion
# Mar 14th 2018, 17:16 sssd @alexmax try form.checkValidity() to see if form is valid
# Mar 14th 2018, 17:15 jeremyharris the inputs aren’t siblings, fwiw
# Mar 14th 2018, 17:15 jeremyharris yeah it works for me just fine in chrome
# Mar 14th 2018, 17:14 jeremyharris hm I have a checkbox required with a hidden field, let me check it out in chrome
# Mar 14th 2018, 17:13 jeremyharris interesting. I’m surprised we haven’t heard of that issue yet
# Mar 14th 2018, 17:13 alexmax It seems like a shortcoming on Chrome's end. Maybe it keeps a list of all 'names' with required, and then hits the hidden field first when it tries to check for it.
# Mar 14th 2018, 17:12 jeremyharris (since the hidden field is not `required`)
# Mar 14th 2018, 17:12 jeremyharris it should only be trying to focus on the actual checkbox though :thinking_face:
# Mar 14th 2018, 17:12 jeremyharris if you remove the hidden input does it work? `hiddenField => false`
# Mar 14th 2018, 17:11 jeremyharris yeah seems correct
# Mar 14th 2018, 17:11 alexmax As you can see, the visible checkbox is marked required, and the hidden field next to it is not. That seems correct, but Chrome does not appear to like it still.
# Mar 14th 2018, 17:10 alexmax Sorry for the IRC folks who had to put up with my edits.
# Mar 14th 2018, 17:10 alexmax ```<div class="input checkbox required"> <input type="hidden" name="foobar" value="0"> <input type="checkbox" name="foobar" value="1" required="required" id="foobar"> <label for="foobar">Foobar Field</label> <small><a href="">Download Foobar Field</a></small> </div>
# Mar 14th 2018, 17:10 jeremyharris it could be trying to focus on it on submit
# Mar 14th 2018, 17:10 alexmax This is what my checkbox field looks like under the covers. I have changed the markup ever so slightly from the original, but I think it's mostly the same, just in a different order.
# Mar 14th 2018, 17:10 jeremyharris or is there a `required` attr on a hidden element somewhere?
# Mar 14th 2018, 17:09 jeremyharris something is trying to focus on an element it can’t focus on. maybe tabbing through, or JS somewhere?
# Mar 14th 2018, 17:09 alexmax But the thing is, I actually like the validation it does on text fields, so I'd like to keep that if posible.
# Mar 14th 2018, 17:08 alexmax I don't think _I_ am doing anything, it's Chrome being too helpful.
# Mar 14th 2018, 17:08 jeremyharris from what I’ve read
# Mar 14th 2018, 17:08 jeremyharris yes likely
# Mar 14th 2018, 17:08 alexmax I think the error message is coming from Chrome's default built-in validation.
# Mar 14th 2018, 17:08 jeremyharris or disabled?
# Mar 14th 2018, 17:07 jeremyharris are you trying to focus on a hidden element?
# Mar 14th 2018, 17:06 alexmax I think it might have something to do with the hidden '0' field before every checkbox.
# Mar 14th 2018, 17:05 alexmax This is happening for every form field that is a checkbox.
# Mar 14th 2018, 17:05 alexmax `An invalid form control with name='foobar' is not focusable.`
# Mar 14th 2018, 17:05 alexmax getting spammed with
# Mar 14th 2018, 17:05 alexmax A CakePHP-generated form is refusing to submit