Update Address Fields with OnClick

This public forum is for user-to-user discussions of ASPMaker. Note that this is not support forum.

Update Address Fields with OnClick

Postby syncnet » Thu Nov 30, 2017 1:16 am

Does anyone have an example of how you would do this in latest ASPMaker?
I have billing address and shipping address. To save time it would be nice to enter the billing address and have a check box __ Shipping Same As Billing so when they click on it it automatically copies data from billing address fields to the shipping address fields. I'm just not sure how I would do this in ASPMaker?
syncnet
 
Posts: 4
Joined: Tue Jul 21, 2015 3:23 am

Re: Update Address Fields with OnClick

Postby Webmaster » Thu Nov 30, 2017 11:10 am

Use the field Client Side Events. Please refer to help file topic: Field Setup -> Client side events for example. Note that in this case you need to:
- subscribe to the field's "click" event
- get the values from source fields and set to the destination fields
Webmaster
 
Posts: 10734
Joined: Fri Aug 06, 2004 5:59 pm

Re: Update Address Fields with OnClick

Postby ready4data » Thu Nov 30, 2017 7:25 pm

Something like this in the Client side events of your Add/Edit page. Pseudo code, not tested.
$('#x_<YourCheckboxName>').change(function(){
if (this.checked){
$('#x_ShipToAddress').val('#x_BillToAddress').val());
$('#x_ShipToCity').val('#x_BillToCity').val());
$('#x_ShipToState').val('#x_BillToState').val());
$('#x_ShipToZip').val('#x_BillToZip').val());
} else {
$('#x_ShipToAddress').val('');
$('#x_ShipToCity').val('');
$('#x_ShipToState').val('');
$('#x_ShipToZip').val('');
}
});

Scott
ready4data
 
Posts: 276
Joined: Mon Nov 19, 2012 8:24 pm


Return to General Discussion (ASPMaker)