Expand my Community achievements bar.

Getting a value from one item and putting into another item.

Avatar

Former Community Member
I tried this with a button and it works.



var myVal = xfa.layout.h(mySF2);

app.alert(myVal);



When I click the button I get the height of mySF2 which is a subform.



When I try to get the same thing with a text field all I get for the value is "-1". Here is what I have tried.



var myVal = xfa.layout.h(mySF2);

TextField1.rawValue = myVal;



I am fairly new to scripting for Designer so what am I not doing right?
5 Replies

Avatar

Former Community Member
What event on what object did you put that script in?



Chris

Adobe Enterprise Developer Support

Avatar

Former Community Member
I was using the calculation event in the text field receiving the value.

Avatar

Former Community Member
That may be too early, try it on the layout:ready or doc:ready event, see if that works.



Chris

ADobe Enterprise Developer Support

Avatar

Former Community Member
Chris,



The layout:ready event does it. Thanks. Now I just need to figure out and learn when to use what for what on some of these events. I know what mouseUp and enter and click event do but some of the the others are new to me.



Steven

Avatar

Former Community Member
Well here is one more thing.



What I am trying to do is when an expand able text field grows and subsequently the subForm grows as a result I want the other fields in that subForm to expand the same height. So far I am just working with a row of two text fields one next to the other. When I add enough lines of text in the one field and click off the field or tab out of it it expands and so does the field next to it. How ever if I come back and remove some lines of text the text field shrinks but the one next to it stays the same and does not shrink. Here is the code.



var myH = xfa.layout.h(SF2);

hVal.rawValue = myH;

form1.SF2.hVal.h = myH + "pt";



If I remove or comment out the third line of code the obviously the second field doesn't expand but the value changes as I enter text in the first field or delete text and the field expands or shrinks.



What's wrong with my code?