notempty validation plugin not working for databasejoins

Bauer

Well-Known Member
I need to stop users from inadvertently submitting empty database join elements (which they can do by unselecting all items in the list).

I am using the notempty validation plugin with ajax validation - but it doesn't work (always shows as ok - green).

Trying for a quick fix I found that the '$data' sent to function dataConsideredEmpty() in databasejoin.php is not an array - but rather an html string ( the data in the form of a <ul> list ).

I tried using $data = strip_tags($data); but still no luck. (It seems that even the ul list being sent to the dataConsideredEmpty() function is not accurate.)
 
It depends how you render your databasejoin element.
If it is a dropdown, you can set "0" as the "please select" value, then use a "isnot" validation.
 
I should have explained - it's a multiselect datbasejoin element.
I tried numerous validation plugins - none worked.
I suppose if I knew the php to use - I could get it working with the php validation plugin.

I just wanted developers to know that the notempty validation is not working for datbasejoin elements (multiselect or otherwise).
 
I used this PHP validation on a CDD rendered as checkboxes. I think that should work for databasejoin:
PHP:
return !empty( $data );
 
Just to followup on this... I discovered today that the 'isalphanumeric' plugin will also work for validation as 'not empty' for a databasejoin element.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top