Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Binding multiple objects into one

Avatar

Level 1

I'm creating a form, and i already have 5 drop down boxes that are bound to 5 other text boxes that generate numbers based on each selection.  This gives me a 10 digit number for purchasing. (2 digit- 1 digit - 4 digit - 2 digit - 1 digit) My question is, can one text box be bound to the 5 drop down boxes, so that when it generates that number, its all in one single text box and can be selected for copying and pasting in another program? 

thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Also, I would not use a minus sign as part of an object's name (eg: BRANCH-DEPARTMENT_INPUT).

This will cause problems with referencing objects and the object name will need to be resolved.

Niall

View solution in original post

7 Replies

Avatar

Level 10

Hi,

You can do this by converting the rawValue from each of the five objects into strings. See toString() method.

this.rawValue = purchasing1.rawValue.toString() + purchasing2.rawValue.toString();

I am also fairly sure that if you place a "" in the script, that LC will take all inputs as strings, so something like this might work:

this.rawValue = "" + purchasing1.rawValue + purchasing2.rawValue;

Good luck,

Niall

Avatar

Level 1

thanks, but i still need a little more assistance (i'm pretty new to doing forms).  I'm assuming that goes in the script editor for the new text box, but under which event?    thanks

Avatar

Level 1

And what if you do not want the raw data, but the value that is bound to the raw data?

Avatar

Level 10

Hi,

You would place this script in the calculate event of the object where you are setting the 10-digit number. Please note that both examples are JavaScript.

A dropdown has up to two values: the display value and the bound value. If you do not set the bound value (in the Object > Binding palette) then the object's rawValue is the same as the display value. If you do set a bound value then when you access the object's rawValue the bound value is returned.

The "rawValue" is JavaScript syntax to access the unformatted value of the object.

See an example here: http://assure.ly/fYCuQ2, which tries to explain this.

Niall

Avatar

Level 1

I'm still very confused about this.  Here is exactly what I need.

I have 4 drop down lists:

COMPANY_INPUT

BRANCH-DEPARTMENT_INPUT

GL_ACCOUNT_INPUT

SEGMENT_OF_GL_INPUT

I have 1 text box:

gl_line_number_output

Each drop down list has data binding to spit out a numbered code.  I have each drop down list bound to a different text field.  What I want to do is direct the bound data from all 4 drop down lists into one text field instead of seperate ones, listing the bound data in succession, to create a complete account number from all 4 drop down lists.  The name of the text field I would like the binding to be directed to is called gl_line_number_output.

I've just started using the LiveCycle software and need someone to write a code exactly as it would appeare if I were to copy and paste it onto script editor.

Thanks you much,

Steve B

Avatar

Level 10

Hi,

Here is an example: http://assure.ly/sd4fgZ.

One covers FormCalc, which uses the concat function and is probably easiest to follow.

The other uses JavaScript and checks to see if a dropdown is null first.

Hope that helps,

Niall

Avatar

Correct answer by
Level 10

Also, I would not use a minus sign as part of an object's name (eg: BRANCH-DEPARTMENT_INPUT).

This will cause problems with referencing objects and the object name will need to be resolved.

Niall