Lots of developer getting confused in manipulating one field value on another field. I also suffer from this when i started learning adobe forms and adobe script. so now i found something that auto reference the fields using below trick.

Also go through To insert object reference syntax automatically: Adobe Forms

Example:

Now lets say i’m having below hierarchy,

Untitled.png

Now i want to write script to fill Sub2 = Sub1 + 10.

Step 1) Click on txtSub2.

Untitled.png

Step 2) Then click in script editor event, where you want to write code to fill Sub2.

Untitled.png

   Now press Ctrl key and drag mouse pointer on field in Design View, pointer icon will change to \/ icon. (v shape icon)

Untitled.png

Step 3) Now when your mouse pointer is change, do mouse click, and reference of field will auto paste in script editor.

Untitled.png

this way you can easily manipulate fileds in adobe forms.

Step 4). Now write below script,

Untitled.png

Output,

Untitled.png

Now, for Total i want Sub1 + Sub2,

Same as i expalined above,

     > select Sub1 or Sub2 (one by one),

     > click in script editor event,

     > press Ctrl key,

     > drag mouse pointer on respective field and

     > do mouse click

Your final script will be,

Untitled.png

For Mass Total, (sub1 + sub2 + total)

Untitled.png

Final Output,

Untitled.png

We get what we want, this may confused you, drop your query below if any.

Hope this helps.

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Christopher Solomon

    Nice and to the point! Just a minor point to add….as a matter of good practice, when you are referencing another field on your form in script outside of your current field (ie.”this”), it is good to do the following…

    this.rawValue = xfa.resolveNode(somefieldname.rawValue);

    xfa.resolveNode will always try to find the named node even if you do not give the exact/whole path. It makes it easier too when you have a very long path name to a field….as long as your fieldname is unique, you can simply use that name and resolveNode will “find” it for you. It is similar to JQuery methods to locate an element in a DOM for you.

    But yes….nice, quick write up to the original post over in the forums!

    (0) 
    1. Prajesh Desai Post author

      Correct me if i’m wrong,


      first the syntax is, this.rawValue = xfa.resolveNode(“somefieldname”).rawValue;

      and trick i shown is gives you shortest possible path, so don’t worry, whenever it feels it generate xfa.resolveNode syntax also (e.g. when your subform is untitled, when having array of same name control etc).

      Thanks for your input. 🙂

      Hope this helps.

      (0) 
        1. Prajesh Desai Post author

          Correct me if i’m wrong,

          yes, you can wrap generated code into xfa.resolveNode if you want. but as per my understanding xfa.resolveNode will search and fieldname will point, so i preffer to point instead of serching.

          (0) 

Leave a Reply