Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

show/hide columns of a table based on drop down

Avatar

Level 1

Hi!

I am new to the whole JavaScript thing and have been able to figure some things out for myself but here, I am completely stumped!  I have a drop down list containing 3 items (plans pricing, gold silver and bronze), and these values are plugged into a table.  Unfortunately due to table size, I've had to spread it out over 2 pages (no breaks, just separate tables).  What I would like to do is; when a user selects say the bronze plan, the columns for silver and gold get hidden.  I have attached an image snippet from my form since the rest contains sensitive information (and i can't figure out how to provide the pdf file version on the forum).  If anyone could help out with the script i would be appreciative since I have NO clue where to even start!  I am using livecycle designer ES 8.2 in windows.

Thanks,

Lauren

By the way... I've noticed a lot of people have read this but no one has posted anything... if you think it cannot be done, at least say so, that way i'm not checking every hour for nothing

stumped.png

0 Replies

Avatar

Level 7

It's easy if you use FormCalc.

What you need to do is rename all your rows to the same thing (so say Row1) and then they will automatically become Row1[0],Row1[1]. etc. Then all you do is in the exit event of the dropdown list put in something like:

if ($ == 1) then

Table1.HeaderRow.Gold.presence = "hidden"

Table1.HeaderRow.Silver.presence = "hidden"

Table1.Row1[*].Gold.presence = "hidden"

Table1.Row1[*].Silver.presence = "hidden"

elseif ($ == 2) then

Table1.HeaderRow.Bronze.presence = "hidden"

Table1.HeaderRow.Silver.presence = "hidden"

Table1.Row1[*].Bronze.presence = "hidden"

Table1.Row1[*].Silver.presence = "hidden"

elseif ($ == 3) then

Table1.HeaderRow.Gold.presence = "hidden"

Table1.HeaderRow.Bronze.presence = "hidden"

Table1.Row1[*].Gold.presence = "hidden"

Table1.Row1[*].Bronze.presence = "hidden"

endif

just make sure you have 'specify item values' ticked in the binding tab of the dropdown list.

You probably want to also put Table1.HeaderRow.Bronze.presence = "visible" etc back into the other choices in case the person changes their mind.

Avatar

Level 1

Thanks for the response, i ended up convincing a programmer friend of mine to come up with a javascript code for it (which in retrospect, seemed a lot easier than I was making it out to be)