Hiding/Unhiding Fields

I have FORM with 3 lookup fields. All 3 are INT()
I created an AJAX event OnChange and added this code:


if {COID} != 0
    {
    sc_field_display({WOID}, off);
    sc_field_display({CUID}, off);
    }

COID is the name of the first field and the other two are: WOID and CUID

[ATTACH=CONFIG]n74120[/ATTACH]

When I run this I get an error. any ideas what is wrong here ?

ART

2017-01-02_2201.png

Just tested another variant by assigning thie method to another field (UserType in this case) and noticed that the field names got converted to the lower case for some (unknown) reason.
here is the code I entered:



if {UserType} == "EMPLOYEE"
    {
    sc_field_display({WOID}, off);
    sc_field_display({CUID}, off);
    }


and here is what SCRIPTCASE generated



if $this->usertype  == "EMPLOYEE"
    {
    $this->nmgp_cmp_hidden["woid"] = "off"; $this->NM_ajax_info['fieldDisplay']['woid'] = 'off';
    $this->nmgp_cmp_hidden["cuid"] = "off"; $this->NM_ajax_info['fieldDisplay']['cuid'] = 'off';
    }



if this is a case then there is a bug in MACRO. I wonder is somebody can confirm this ?
Thank you

Maybe the if statement require round brackets…

and this is the piece of code failing in your other thread. As we told you, this if is not correct. “if” expression must be between parenthesis

SOLVED

NEVER MIND - I got it working. The reason - LACK OF PROPER DOCUMENTATION ;-(
Yes, the brackets was another issue (which I discovered right after initial post, but it still did not work. Now it’s working.
I was making the field HIDDEN on the form hoping the showing field will make it unhidden. No it does not work like this. The HIDDEN property is separate from Showing/Not_Showing field.

I learn it hard way but hopefully this will be helpful for others who have similar problem.

Thank you very much all of you - who replied.