Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Changing X coordinate appears not to work

Avatar

Level 1

I have a text field directly on a master page (there is a good reason for this) and I want to change it's X coordinate using Javascript code like this:

// directly call the "x" attribute

this.x = "200mm";

//  use a method call to change it

this.setAttribute ("200mm", "x");

I tried using events like initilalize, calculate, form:ready, form:layout, but the field won't move.

What is strange is that changing the field width works, using similar code:

// directly call the "w" attribute

this.w = "200mm";

//  use a method call to change it

this.setAttribute ("200mm", "w");

What am I missing? After some googling it appears these two fields ("x" for X coordinate and "w" for width) are pretty much alike.

I would be happy if someone could tell me if this works for him/her. At least I would now I haven't reached a dead end.

I'm using Lifecycle ES2 by the way.

4 Replies

Avatar

Level 7

Did you save the form as a Static or Dynamic PDF? Static PDFs likely won't allow objects to be moved with code.

Avatar

Level 1

Yes, according to this Adobe page, form should be saved as dynamic: LiveCycle ES2 * Adobe LiveCycle Designer ES2.

But width parameter w is in the same category and it works.

Where do I change this setting? There is one such setting for previewing the form (preview as either static or dynamic), which doesn't cause any improvement by the way.

Avatar

Level 7

You change the from Static to Dynamic or vice versa via the Save As dialog

664820_pastedImage_0.png

Avatar

Level 1

I hope this helps answer your question. I have a Subform that has a XAnchor of 0 and a YAnchor of 2. I have a button on that subform that I want to move from the current position to x coordinate of 4.0in and a y coordinate of 5.4in on the click event of another button. So at first I thought I would enter the below JavaScript on the click event of my button.

Button.x = "4in";

Button.y = "5.4in";

But that is not the case, I couldn't find it, that's because when I did that it moved it comparatively to the x and y anchors of the subform my button was on. So the x was at 4in(which was accurate) but my y was at 7.4 because the subform is anchored at 2(it didn't appear to me because my page is only 7in height). So what I had to do was change the JavaScript to say the below and it put it perfect where I wanted it.

Button.x = "4in";

Button.y = "3.4in";