Not Empty Validation - CCD - if more =>1 result

nbradshaw

Active Member
I am using a Cascading Dropdown - with the "Please Select" option enabled.

I am doing a "not empty" validation:
return '{itr_2_428_repeat___request_type_raw}' == 'Add';

This works as expected, however, I do not want this to return true if there are no dropdown values for the CCD.

Is there another condition that I can add to make sure that it will only return true if there are options (returned results) under the CCD?
 
Is "request_type" the CDD itself?

The code you quoted, is that in the Condition of a notempty?

Is "Add" your "please select" value?

-- hugh
 
Ah, OK, I think I understand. So at the moment, the 'notempty' won't run if type is "Add", so it's possible to submit an empty selection.

I think just ...

return !empty($data) && '{itr_2_428_repeat___request_type_raw}' == 'Add';

... would do it.

-- hugh
 
Ok - let me do a better job of 'splainen :)

For the CCD dropdown - I am only wanting to run the validation IF the dropdown has selections to choose from (other than select). If there are no CCD dropdown selections - I want to skip validation. (Although there will still be a 'Please Select' Option there...just with nothing underneath it.).
 
Oh, right. Hmmm, can't really do that, as once submtted, there's no way of telling what was in the dropdown. Only the selected value gets submitted with the form - that's not a Fabrik thing, it's an HTML thing.

I guess you could do it the long way, by grabbing the value of the element the CDD watches, and query your CDD table with a WHERE clause (as if you were building the CDD's selection), and see if you get any rows back.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top