AnsweredAssumed Answered

Hide/enable field based on column layout selection

Question asked by Amala on May 29, 2015
Latest reply on Jun 3, 2015 by Lindsay_Estabrooks

Hi,

 

I tired to enable or disable text boxes based on selected value in the column layout. I have 2 values (A,B) and two text box (X,Y).

I am using java script function to enable/disable the fields.


If A selected it has to enables the 'X' text box. If B selected it has to enables X,Y text box. If i deselect B and I select A and B together it has to enable X,Y text boxes again. If none of the above selected all text boxes should get hidden


I am executing the below java script code in the onchange.

 

Code:

 

ShowOrHideloc : function() {

var selected = ca_fdGetSelectedOptionValues(ca_fd.formId, 'loc')[0];

if (selected == 'A')

{

  ca_fdShowField(ca_fd.formId, 'X');

  ca_fdHideField(ca_fd.formId, 'Y');

}

 

else if (selected == 'B')

{

  ca_fdShowField(ca_fd.formId, 'X');

  ca_fdShowField(ca_fd.formId, 'Y');

}


else if (selected == 'A' && selected == 'B')

{


ca_fdShowField(ca_fd.formId, 'X');

ca_fdShowField(ca_fd.formId, 'Y');

}

else

{

ca_fdHideField(ca_fd.formId, 'X');

ca_fdHideField(ca_fd.formId, 'Y');

}

},

 

 

I am facing issue on here where the If i deselect B and I select A and B together it has to enable X,Y text boxes but  it is not happening.




Regards,

Amala


Outcomes