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.
SOLVED

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

Avatar

Level 3

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/ 

 



Arun Patidar

View solution in original post

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/ 

 



Arun Patidar

Avatar

Level 3

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.