Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

'Inserting' text into a Text Field on event trigger in a static form

Avatar

Level 2

Sorry if this seems like a silly question, but I've been struggling with it for a bit and I'm new to Adobe/JavaScript.

I am building a static form (it must be static), and I want to have text appear/disapear based on an event trigger (mouseclick). I tried creating a floating text object inside of a static text object, but I'm not sure how I can make the string value for this change based on the event trigger. The only advice in the Adobe help was purely regarding FormCalc, which I can't use as this must be a static form. I tried using this code in the <script>, but it obviously didn't work as it was written from FormCalc code versus JaveScript;

TextField.rawvalue = variable.value;

What do you suggest in terms of being able to script this, so my static form will work? Thanks a billion if you can help!

PS: I'm using Adobe 9, LiveCycle ES 8.2

PPS: Also tried inserting the following into my trigger script;

                    xfa.resolveNode("form1.subform.TestField").rawValue= "Please Work";
                    xfa.layout.relayout("form1.subform.TestField");

It also did not work.

6 Replies

Avatar

Level 5

Hi,

Exactly where is your script, you say "mouse click" but on which object is this set.

from your text I assume you are changing the value in the TextField box, not the caption, is that correct?

Regards

Malcolm

Avatar

Level 2

It is set on a button field. See below.

I am trying to change the TextField. Thanks for any advice.

Avatar

Level 5

Hi,

If the button and the textfield are on in the same subform then this code should work in the click event of the button

(This is JavaScript code so make sure the code is set to JavaScript and Client on the drop downs in the script window)

(assuming the name of the textfield is TextField1)

TextField1.rawValue = "some value";

If they are in different subforms then you have 2 options

Please note in both these options it is easier if the subforms have names ( I am assuming this to keep samples simple)

option 1 -

use the parent object to move up the tree till you are at the same level as that of the subform that contains the textfield

e.g. 

(Click Event of the button)

this.parent.subformname.TextField1.rawValue = "some value";

option 2 -

Use the resolve node to make your way down from the top level of the form

xfa.resolveNode ("form1.subformname.TextField1").rawValue = "some value";

Hope this helps

Malcolm

p.s. I am making assumptions as the image/file you attached did not appear for me.

Avatar

Level 2

The button and text field are on the same subform, and everything has been set to use JavaScript code. I would like to send you my code, as I implemented exactly what you said below, but am not having positive results, and it appears my email system will not let me send JavaScript. Should this be possible in a Static form? Thanks.

Avatar

Level 5

Hi,

Can you upload the file to a sharing site ( dropbox, acrobat.com ......)?

Regards

Malcolm

Avatar

Level 2

I apologize-- it appears to work when the object is a text field, but not a text object. I was trying to change the text of a floating field inside of a text box. The only way that I can put the floating field in the text object is if it is set to hidden, and then it can't be made visible. I tried TextField.presence = 'visible'; after the changing of the .rawvalue, but it doesn't display. Is there any way for me to do this? Thanks!

Possibly by taking out some of the letters, the email scanners will not have an issue.

<s***** contentType="app*cation/x-j********" runAt="both">

Mask.presence = 'invisible';

SignButton.presence = 'invisible';

UnsignButton.presence = 'visible';

Sign.presence = 'visible';

Message.rawValue = "some value";

TextField.rawValue = "some value";

TextField.presence = 'visible';

</s*****