Hide an empty databasejoin element?

emcguire

Member
I have a databasejoin element in my my form(render as dropdown), I would like to hide if empty. I have the JS set to hide if value "" but it's not working. When inspecting the element, the "option" value is just a  

I tried to set a default value, tried using "Please Select...", but the problem with that if there IS data there, it defaults to "Please Select" which I don't want (It is filtered to only ever show one value)

Is there some other way to hide an empty databasejoin dropdown field?
 
By "empty" do you mean if there is no selected value, or if there are no values to select in the dropdown?

If the latter, we don't have a built in way of testing for that. You'd have to add your own 'onLoad' code on that element that does something like ...

Code:
if (jQuery('#yourtable___yourelement option').length <= 1) {
   this.hide();
}

if you have a "please select" use <= 1, if you don't, just do == 0.

-- hugh
 
Nope, the preset stuff is only looking at the "value", eg what option is currently selected. What you wanted to test was how many possible options there are to select from.

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

Thank you.

Members online

No members online now.
Back
Top