Passing a set of user entered data to another area of a formSome time we have to copy the values or data of some entered fields to another group of fields. The same value as entered by the user will be copied to another set of similar fields on click of a radio button. For example we have asked our visitors to submit there residence address and office address. For some visitors both may be same so they can click one period button to copy the address entered as office address to the residence address. This will help them as they need not enter the same address again. We will provide one more period button to clear the residence address if it is clicked accidentally.
Here we will use the onclick event of a radio ( or period ) button to execute a function name data_copy. This function we will keep inside head tag. Inside this function we will copy the value of first group entered data to the second group corresponding fields. The second radio button when clicked it will clear all the data of second group of fields.
We will monitor which radio button is clicked by using a if condition check if document.form1.copy.checked is true or not ( first radio button ) Here is the full code