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

Simple formCalc script to set ALLtext fields = 1 text field

Avatar

Level 2

I want to add a button that will calculate all text fields in the form = 1 individual text field. I cancalculate 1 txt field = another text field, but don't know how to set multiple text fields = 1 text field. Ex: AutoFill button.

Thanks!

-JoeF

3 Replies

Avatar

Level 10

Hi,

I am not sure if we have discussed this before, but there if a global binding property. You would use this where you want any number of fields to display the same value.

  1. Make sure all of the fields that you want to display the same value have the exact same name in  the hierarchy.
  2. Select one of the fields and go to the Object > Binding palette. Then change the binding to global.

If you have a few fields you can script the values of the fields to make an existing field(s). There is an example here for duplicating postal addresses: https://acrobat.com/#d=xlp1fdqbrseULbRJpw6u9g.

You could also script a loop to look through all of the objects and set the value accordingly. However this is more involved. What is your comfort level?

Niall

Avatar

Level 2

Thank you for your reply...I got the answer a bit differently as I wanted to use a button to AUTOFILL. Here's what I did:

topmostSubform.Page1.OC.Button2::mouseUp - (FormCalc, client)

File_Name[1]=File_Name

File_Name[2]=File_Name

File_Name[3]=File_Name

File_Name[4]=File_Name

File_Name[5]=File_Name

File_Name[6]=File_Name

File_Name[7]=File_Name

File_Name[8]=File_Name

File_Name[9]=File_Name

File_Name[10]=File_Name

Avatar

Level 10

Good!

As you are using FormCalc you can use this:

File_Name[*] = Main_File_Name

This is where you would rename the file name object where you will want the users to fill in.

"File_Name" is actually the first instance, eg "File_Name[0]".

The mouseUp event is okay, because at that stage the user has committed to clicking the button. I would tend to use  the click event. It will achieve the same result, but is more intuative for maintaining the script.

Niall