You are viewing limited content. For full access, please sign in.

Question

Question

Hiding/Showing Table columns

asked on December 29, 2014

I'm attempting to build a form for a client containing a table where the selection made in the drop-down field in one column will change the "text under field" displayed for a different column in the same table. 

My first thought was to use the Field Rules "Show" and "Hide" options to alter the behavior of the subtitle, but Field Rules don't appear to have that level of specificity.  I then thought to add new columns that would themselves get shown or hidden depending upon the selection in the drop-down box (with the only substantive changes between these new columns being the column labels and the subtitle), but that approach didn't fully hide the unused columns, just greyed them out.

My client is adamant that this section be presented as a table, not as separate fields (understandable, given that they want the user to have the ability to add rows, and data from a different column in the table is used for a calculation process a little further along). 

0 0

Replies

replied on December 31, 2014

I'll give my 2 cents: you can do this with javascript, but it won't be easy. You will run into several issues that will make this challenging.

My thought is that you can modify the text using javascript based on some condition that you respond to (say, a change event on the drop-down you're using). The column header is easiest, but if you have "text under" the field, you will need to loop through all the rows to change everything.

Also, any time you add a new row, it will be added with the original "text under" so you would need logic to handle changing it properly for adding new rows.

Finally, you need to be aware that when you submit the form, the page gets reloaded before the image is generated. You will have to build some logic that ensures the text gets modified properly when the form gets reloaded. One way to do this is to add hidden fields to store data in as the form content gets dynamically changed, and then check this hidden field when the form loads to re-apply the changes. If you search a few posts on here, you can find information about each of these pieces, although I don't have time to put all the code together for you here today.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.