Expand my Community achievements bar.

Help with radio buttons and show/hide javascript

Avatar

Level 2

Hi. I'm new working with LiveCycle and also pretty much at a basic/beginner level of javascripting. I'm creating a pdf fillable form and one of the tasks I've been given is to add a function where if Option A is chosen by the user, then the correspondng table will appear, and if Option B is chosen another table will appear. After some searching I Iearned more about how radio buttons can be used, so I created a set of radio buttons. I have tried several different things, the latest was making both tables "hidden", and then taking to the radio button list group and applying the show/hide script to each of the radio buttons in the group. Still nothing seems to be working as I want it to. The table remains hidden when I click on the . This is what the code looks like right now. I know I'm obviously doing something wrong, this seems like such a basic thing to code. Getting to the frustration point, if you can sort me out with what I am missing/overlooking please let me know. Many thanks!

Note. The radio buttons are not in the same table, they are higher up in the form outside of the tables that I am trying to show/hide, but they are in the same subform. I don't know if that might be an issue?

form1.#subform[0].RadioButtonList::click - (JavaScript, client)

    

form1.#subform[0].RadioButtonList.#field[0]::click - (JavaScript, client)

 

   if ( RadioButtonList.#field[0].selectedIndex == 1)

     form1.#subform[0].Table1_Work.presence = "visible"

   else

   form1.#subform[0].Table1_Work.presence = "hidden"

form1.#subform[0].RadioButtonList.#field[1]::click - (JavaScript, client)

   if ( RadioButtonList.#field[1].selectedIndex == 2)

    form1.#subform[0].Table1_Official.presence = "visible"

  else

     form1.#subform[0].Table1_Official.presence = "hidden"

13 Replies