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

Concat Problems

Avatar

Former Community Member
I am trying to combine input from two text fields into a third field.



When I select the third field, I set it as "calculate" and then in the script line I choose FormCalc and then type in the following

TextField11 = Concat(ProjectNum, CPNumber)

FYI: all three fields are set as text fields, despite the fact I have called them numbers)



When I run the form I receive the message



...Error: accessor 'ProjectNum' is unknown.



How do I join ProjectNum to CPNumber to get a third field called TextField11?
2 Replies

Avatar

Former Community Member
Hi,

Try the following code:

TextField11.rawValue = Concat(ProjectNum.rawValue, CPNumber.rawValue)

Remember to save as dynamic form.

You can also use javascript:

TextField11.rawValue = ProjectNum.rawValue + CPNumber.rawValue

I think the javascript method is more flexible. Avoid using Formcalc when you can.I hope this helps you.

Avatar

Former Community Member
Note that your form does not have to be dynamic to add two fields together.