Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

form container - Copy text value to another text value based on checkbox

Avatar

Level 2

Hi Team

 

I am working on form container on AEM page where I have added AEM form container within that added a container and added form options input.

 

I would like to achieve functionality like below. when checkbox is selected I want copy shipping address to Billing address, when unchecked the billing address should get cleared.

 

pras78022281_0-1678873815163.png

 

Please provide me some lead on how to progress on this requirement.

 

Thanks and Regards

Prashanthi

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

This you need to achieve using javascript or jQuery.

https://html.form.guide/html-form/html-checkbox-events/ 

 

2 Replies

Avatar

Correct answer by
Community Advisor

Hi,

This you need to achieve using javascript or jQuery.

https://html.form.guide/html-form/html-checkbox-events/ 

 

Avatar

Level 2

Thanks @arunpatidar 

I have updated the .html file of form-options-input and now I am able to map by using below script.

<script>
displayModelCheckBox = () => {
var isChecked = document.getElementById('Res-address-checkbox').checked;
if(isChecked){
document.getElementById('new-building-name-section').value = document.getElementById('building-name-section').value;
}else{
document.getElementById('new-building-name-section').value = '';
}
}

 

It is working fine as to go for better approach I will place this script in clientlibs.

 

Thanks for your response.