form container - Copy text value to another text value based on checkbox | Community
Skip to main content
Prashardan
Level 4
March 15, 2023
Solved

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

  • March 15, 2023
  • 1 reply
  • 857 views

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.

 

 

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

 

Thanks and Regards

Prashanthi

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Hi,

This you need to achieve using javascript or jQuery.

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

 

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
March 15, 2023

Hi,

This you need to achieve using javascript or jQuery.

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

 

Arun Patidar
Prashardan
Level 4
March 16, 2023

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.