Copy link to clipboard
Copied
My form has a set of fields that I'd like the user to determine how many are necessary. Each block of fields is the same.
I'm trying to get the 'Add Sequence' button to display the hidden fields below the preceding fields. Currently, my button works to display 1 block of fields, but I'm
wondering if it's possible to get the 'Add Sequence' button to display a sequential hidden field each time it's clicked.
Yes, this can be done, as I've described in the previous response. The key is keeping track of what's visible, as both try and I have stated
There's a couple of ways to do this. Here's an easy one.
1. Put a hidden text field on the form named "SeqNum". Default it to a value of 1.
2. Put this code in the button that shows the blocks
var nNum = ++this.getField("SeqNum").value;
if(nNum < 6)
this.getField("Block" + nNum).hidden = false;
This code handles up to 5 blocks.
Copy link to clipboard
Copied
It's possible, but it would require using a script, as you'll need to keep track of which fields are currently visible and which ones are not.
Copy link to clipboard
Copied
I could have sworn I already answered this yesterday. Maybe this is a re-post to another topic? Anyway, here is may answer
Yes, this is possible. The fields need to be named in such a way that the blocks are grouped for hiding and showing, and for determining order of visibility. For example, Block1.dimension, Block1.method etc.
Now this code will show all fields in block 1
this.getField("Block1").hidden = false;
Keep track of the sequence by looking at which blocks are hidden or shown.
If there are page graphics and text involved, it gets more difficult. The only way to hide/show page content is with OCGs, also called layers. There are a number of preflight tools for attaching content and fields to OCG layers (which is actually another way to show/hide form fields). There are also ways to build a page by combining multiple pages, with each placed on a different OCG layer.
Copy link to clipboard
Copied
Is it possible to use that code this.getField("Block1").hidden = false; multiple times on the same button to make it so that each sequential click will hide/show the next block ?
Copy link to clipboard
Copied
Yes, this can be done, as I've described in the previous response. The key is keeping track of what's visible, as both try and I have stated
There's a couple of ways to do this. Here's an easy one.
1. Put a hidden text field on the form named "SeqNum". Default it to a value of 1.
2. Put this code in the button that shows the blocks
var nNum = ++this.getField("SeqNum").value;
if(nNum < 6)
this.getField("Block" + nNum).hidden = false;
This code handles up to 5 blocks.
Copy link to clipboard
Copied
Thank you! I'm fairly inexperienced with Javascript (and coding in general) this is working for me.
Would the similar code (but changed to subtract sequence numbers) under the "Remove Sequence" button work in tandem? So that let's say I've added up to Block 5, and clicking the Remove Sequence button once will now only show the top 4 blocks?
Copy link to clipboard
Copied
Yes, just change the "++" to "--", and the if to (nNum > 0)