Skip to main content
toddr14813053
Inspiring
January 20, 2021
Question

Hidden Fields Appear at Specific Coordinates

  • January 20, 2021
  • 2 replies
  • 904 views

I have a fillable form that has several hidden fields. When a choice is made from one of the drop down lists, then one of the hidden fields will appear. As there are several drop downs that have the same options, what I am hoping to do is have the hidden field appear at a specific set of coordinates on the form. If the user chooses the same option from one of the other drop downs, then the same hidden field may appear at a different set of coordinates. Does that make sense? 

 

I have been shooting in the dark. Making the field appear is not the problem. I am using the following to make the field appear. I don't know how to get it to appear at specific coordinates like x=510 and y=77 or oCoords: [510,77,580,59]; etc.:

 

this.getField("Test").display = display.visible;

 

Thoughts?

This topic has been closed for replies.

2 replies

toddr14813053
Inspiring
January 28, 2021

So, I didn't get a specific answer from the thread that solved my issue, but I did find a work around using the this.addField and then referencing the field I wanted to appear and the coordinates where I wanted.

try67
Community Expert
Community Expert
January 28, 2021

The answer above is the correct one. If you used addField then you've done the same thing as was suggested, ie. to set the rect property of the field. In addField it's the last parameter, but you can also use it on an existing thing, like this:

this.getField("Text1").rect = [x1, y1, x2, y2];

toddr14813053
Inspiring
January 28, 2021

I changed the code to read how you had it, but the hidden field "Luca" still does not appear. I know I'm not the greatest at this, but I still can't see what I'm missing. Here is what I put:

 

this.getField("Luca").rect = [144,474,306,424];

 

I need the field "Luca" to go from hidden to visible at the specified coordinates when Luca is chosen from the drop down and then I need it to go back to hidden if another option is chosen in the same drop down field.

 

Sorry for the headache.

Bernd Alheit
Community Expert
Community Expert
January 20, 2021

You can set the property "rect".

toddr14813053
Inspiring
January 20, 2021

I'm confused how to use rect. Isn't that normally used to draw a rectangle? I already have a predesigned field ready, I just need have it appear at the right coordinates. What coding would you use in this case?

Bernd Alheit
Community Expert
Community Expert
January 20, 2021

You can read and set it with this.getField("Test").rect