checkbox to duplicate variables

R

RH

I have a form with home address & business address fields.

When a user goes to this form, the fields pull the information that is
stored in the database, then they can update their information.

What I would like to do is have a checkbox/radio button/button that allows
the user to specify that the business address is the same as the home
address and replace all the business addy fields to the same value as the
home addy.

So when you click/select this button, the business address fills in (if
empty) or changes (if it has values) to the same values as home.

Then when the form is submitted, these changes are written as normal.

Is this possible and if so, can someone point me to an example?

Thanks in advance

Robyn
 
W

William Morris

This issue would be handled with client side script. You might post
questions like this to a javascript group.

But, while we're here:

<input type="checkbox" name="myCheckbox" onClick="copyStuff()">

<script>
function copyStuff(){
if(document.myCheckbox.checked){
document.form1.bizAddress.value =
document.form1.homeAddress.value
// ... and so on.
}
}
</script>
 
R

Ray at

If you want the text to appear in the other boxes when the user checks the
checkbox, you'd have to use client-side script for that. As far as the ASP
side, you can do something along the lines of:

<form....
<input type="checkbox" name="BusinessAddressTheSame" value="1">
....
</form>

<%

'''code to get normal address
sAddress1 = Request.Form("address1")
sAddress2 = Request.Form("address2")
'''etc.

bAddressTheSame = CBool(Request.Form("BusinessAddressTheSame")

If bAddressTheSame Then
sBusinessAddress1 = sAddress1
sBusinessAddress2 = sAddress2
'''etc.
Else
sBusinessAddress1 = Request.Form("BusinessAddress1")
sBusinessAddress2 = Request.Form("BusinessAddress2")
'''etc.
End If
%>

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,277
Latest member
VytoKetoReview

Latest Threads

Top