Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

onchange client script reverse

gvramanarao
Tera Contributor

I'm writing client script -

my requirement is simple: if the category is 'software' then make 'description' field hidden. It is working fine, but I want to write reverse if, and I stuck there! When Im changing the category to some other, the description field is not visible. 

3 REPLIES 3

palanikumar
Giga Sage

Hi,

I suggest you to use UI Policy for this

Condition = category = software

UI Policy Action:

Add entry for Description and set visible to true

 

Note: UI Policy will reverse automatically

 

If you are using Client Script, then it should be a onChange Client script on variable category.

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

    if (newValue == "software") {
        g_form.setVisible("description", false);
    } else {
        g_form.setVisible("description", true);
    }

}
Thank you,
Palani

Thank you

gvramanarao
Tera Contributor

Thanks @palanikumar