Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

How do you auto-populate a text field based on entries in other text fields?

Avatar

Level 1

I would like to be able to have a text field that populates as "Complete" or "Incomplete" based on whether all the mandatory text fields have been filled out or not.

For example, if the "First Name," "Last Name," and "City" text fields are not filled out, the "completion status" text field will show "Incomplete" and once they are filled out, the "completion status" text field will turn into "Complete."

How would I do this using javascript? I've searched the web for a tutorial, but most of the results seem to be dropdown-centric.

Please point me in the right direction!

1 Accepted Solution

Avatar

Correct answer by
Level 7

Try the script below. I put this on the calculate event for Field1

if(FirstName.rawValue == null || LastName.rawValue == null || City.rawValue == null){

Field1.rawValue = "Incomplete"

}

else

Field1.rawValue = "Complete"

View solution in original post

3 Replies

Avatar

Correct answer by
Level 7

Try the script below. I put this on the calculate event for Field1

if(FirstName.rawValue == null || LastName.rawValue == null || City.rawValue == null){

Field1.rawValue = "Incomplete"

}

else

Field1.rawValue = "Complete"

Avatar

Level 1

Thank you for the response! It's working!

Avatar

Level 1

Hi!..

How do you Auto populate or like copy from first cell.

for example

Name:___________

etc

etc

etc

Name: ____________

hope to hear from you.