Expand my Community achievements bar.

Changing background color when selecting from a dropdown

Avatar

Level 5

Good Day

I am trying to set the background color and font color when a user selects an item from a dropdown box. So far I have not got the background color to work. Below is the code I was using. For “case 1” I added the line “this.fill.color.value= "0,204,0";” I got the following error in the Java Console “TypeError: this.fill is undefined

5:XFA:form1[0]:#subform[0]:p_project[0]:Table5[0]:Row1[0]:DropDownList5[0]:exit”

Here is the code

switch (this.rawValue)

{

case "1":

    this.font.fill.color.value = "0,0,0";

    this.fill.color.value= "0,204,0";

      break;

    case "2":

    this.font.fill.color.value = "0,204,0";

    break;

   

    case "3":

    this.font.fill.color.value = "255,215,0";

    break;

   

    case "4":

    this.font.fill.color.value = "255,0,0";

    break;

case "5":

    this.font.fill.color.value = "0,0,0";

      break;

}

Any suggestions

Thanks All

Chomp

2 Replies

Avatar

Level 9

Hi Chomp,

Instead of fill.color use fillColor for fillable area or use fontColor for fonts.

Thanks,

Bibhu.

Avatar

Level 5

Thanks Bibhu;

The suggestion did not work that well but it did give me an idea. I used the code below in the "exit" event and I was able to change the the border color.

switch (this.rawValue)

{

case "1":

    this.font.fill.color.value = "0,0,0";

    this.border.fill.color.value= "255,255,255";

 

}

Thanks Again Bibhu