Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Concatenating Textfields with buttonclick and Javascript

Avatar

Former Community Member
Hi,I´ve tried to create a simple example with three textfields. I wan´t to write two texts (givenName and surName) that puts the string value in the third field when I click on a button. How can I access the stringvalue in designer? I place the script on the button and click event but can´t get it to work. How can the script look like? What method can I use that work? I´ve tried rawValue, value and toString but don´t get it to work.



I would be very thankful for some help.



Rikard
1 Reply

Avatar

Former Community Member
I prefer to write my code in javascript so here it is. Lets assume your fields are called FName, LName and Name.



On the calculate event of the Name field enter this code:



Name.rawValue = FName.rawValue + " " + LName.rawValue;