Goofy validation behavior

Bauer

Well-Known Member
I have a dbjoin element set to use checkboxes.
Regardless which validation plugin I try to use, the validation plugin seems to prevent the checkbox from being checked (or unchecked).

After the first checkbox is checked, you have to click any checkbox twice before the desired check/uncheck actually works.

Trying to debug this (using the php validation plugin), by sending the $data and {placeholder} values to the php error log - it looks like the validation is being run twice. For every click on a checkbox there are 2 entries in the error_log and the $data value is always a single array element while the placeholder is a string (the last option value checked).

And since both the $data array or {placeholder} will always return a single value - there is no way to check for how many checkboxes are checked, nor the array of values selected.

In other words, attempts at validation is pretty much worthless - except for maybe the 'not empty' validation.

It seems to me that for any validations on any multiselect elements you would need to include the array of the currently checked or selected values back to the server with the ajax call - since it appears that back on the server all php 'knows' is the original value from when the element was last loaded into the form. Or maybe, besides the $data array, you need a '$fluid_data' array for any multiselect elements just to track that?

At any rate, I don't think I've ever been able to use validations on a multiselect element that worked as expected.:(
 
I haven't tested it on a checkbox join, but it seems to work OK for a checkbox:

http://screencast.com/t/iBneUtOdRR

... which has a PHP validation that just counts the selections and insists on 2 being selected.

Do you see the behavior you describe on "normal" checkboxes, or only on checkbox joins?

-- hugh
 
Just tested in my 'test' list using standard bootstrap template for both the list and form. I added 3 elements - a single checkbox, multiple (4) checkboxes, and a dbj rendered as checkboxes. I added 'Not empty' validation to all 3.

The only time this happens is with the dbj. And it happens regardless if the form is opened in a popup or not. It's as if the validation spinner comes before the checkbox is added (or removed) and I have to click again for it to 'take'. :(
 
You the man, Hugh! That seems to have fixed it - and simple enough that I didn't even have to update from github.:)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top