Creating a field selector based on the value of another field

Creating a field selector based on the value of another field

I have fields A, B and C of which A is a drop down with possible values X or Y. I want both fields B and C to stay hidden when the form starts up. If A = X, then I want field B to show up and accept an entry. If A = Y then I want field C to show up and accept an entry. I tried this but it is not working..

  1. For field B and C, I have "hide fieldB" and "hide fieldC"
  2. For Field A, I have
              if (input.fieldA == "X")
              {
                  show fieldB;
                  enable fieldB;
               }
               elseif (input.fieldA = "Y")
               {
                  show fieldC;
                  enable fieldC;
               }
                else
               {
                  hide fieldB;
                  hide fieldC;
               }

When I run the form, all the fields A, B and C are showing up right away.

How do I fix it?    Can anyone please help? I am new to Zoho