Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

I have 5 yes checkboxes and 5 No checkboxes. If any No is selected. a field is turn grey, even if 4 Yes checkboxes is selected. How would the script be?

Avatar

Level 4

Hi,

I wrote the following script but it does not work:

if((form1.Page1.CBox1.rawValue==1||form1.Page1.CBox2.rawValue==1||form1.Page1.CBox3.rawValue==1||form1.Page1.CBox4.rawValue==1 || form1.Page1.CBox5.rawValue==1) && (form1.Page1.CBoxNo1.rawValue!=1)){

    form1.Page1.CheBoxfield.fillColor = "125,125,125";

}

The above is just one condition, and it does not work. I do not know why it does work. Please users help.

Thanks

Tammy

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi,

Try this code

if(form1.Page1.CBoxNo1.rawValue == "1" && form1.Page1.CBoxNo2.rawValue == "1" && form1.Page1.CBoxNo3.rawValue == "1" && form1.Page1.CBoxNo4.rawValue == "1" && form1.Page1.CBoxNo5.rawValue == "1")

{

form1.Page1.CheBoxfield.fillColor = "125,125,125";

}

else

{

form1.Page1.CheBoxfield.fillColor = "255,255,255";

}



View solution in original post

2 Replies

Avatar

Correct answer by
Level 2

Hi,

Try this code

if(form1.Page1.CBoxNo1.rawValue == "1" && form1.Page1.CBoxNo2.rawValue == "1" && form1.Page1.CBoxNo3.rawValue == "1" && form1.Page1.CBoxNo4.rawValue == "1" && form1.Page1.CBoxNo5.rawValue == "1")

{

form1.Page1.CheBoxfield.fillColor = "125,125,125";

}

else

{

form1.Page1.CheBoxfield.fillColor = "255,255,255";

}



Avatar

Former Community Member

Hi,

Please try this code in Validate Event of CheBoxfield :

form1.bdyMain.CheBoxfield ::validate - (JavaScript, client)

if(form1.bdyMain.No1.rawValue == 1 || form1.bdyMain.No2.rawValue == 1 || form1.bdyMain.No3.rawValue == 1 || form1.bdyMain.No4.rawValue == 1 || form1.bdyMain.No5.rawValue == 1 )

{

  this.fillColor = "125,125,125";

}

else

{

  this.fillColor = "255,255,255";

}

Hope,this help.

S,Candy.