Is there a way to remove/hide the search box in a Yes/No Variable of a Record Producer?

Jordan Dehneh
Tera Expert

Hello,

Is there a way to remove/hide the search box in a Yes/No Variable of a Record Producer? Because it doesn't make sense to put a search box in a Yes/No variable which has only two choices.

find_real_file.png

Thanks

2 REPLIES 2

Michael Jones -
Giga Sage

Not out of the box and not universally. You can do this with jQuery (DOM manipulation) which isn't recommended, but in this case (just hiding something you don't want) there isn't much risk other than it may stop hiding at some point if there is a significant change. You have to do it individually for each yes/no field however, which can be a pain. 

Try this: load your item in the portal and click on the yes/no field, then right-click on the search-box and select inspect (chrome). Look for the div that has a class like "select<number>-search" and right-click on it and select copy selector to get the ID for that specific search box. 

find_real_file.png

You should get a string like "#select2-drop > div"

Then, create an onload script like this - it's a little complex as you have to wait for the fields to render before you can apply the css. 

function onLoad() {

    //We need to wait for the form to load
    waitForLoad();


}

function waitForLoad() {

    if (!formIsLoaded()) {
        //If the form has not loaded, sleep for half a second and check again
        setTimeout(waitForLoad, 500);
        return;
    }

    //Otherwise we can now hide the search box
    this.jQuery('#select2-drop > div').css("display", "none"); //update with your selector!

}

function formIsLoaded() {
	//update with your selector!
	if(this.jQuery('#select2-drop > div').length== 0) {
		//the thing we want to change does not yet exist
		return false;
	}
	return true;
}

 

All in all it works, but I'd probably say it's more trouble than it's worth vs. leaving the search box in place unless this is just a one-off type need. Not something I'd try to apply liberally. 

I hope this helps!

If this was helpful, or correct, please be kind and mark the answer appropriately.

Michael Jones - Proud member of the GlideFast Consulting Team

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Jan-Niklas Trau
Kilo Explorer

Hi,

If only Yes or No is to be selected, wouldn't a simple check box do the trick?

"Yes" or "No" would become "true" or "false", and you wouldn't have to mess with the search box.

I hope this will help you to solve your problem.

Jan