I was thinking of putting a check box that states, "Check if address is same as above"
Question
Question
What is the best way to populate address if Vendor Address and Shipping address is the same on a Form?
Replies
Here is what I came up with for the way you are doing it.
// Copy Mailing Address
$(document).ready(function () {
$('.AddrSame').click(function () {
if($('input[value="Yes"]').is(':checked')){
$('.Shipping input[id*=_DSG0]').val($('.Street input[id*=_DSG0]').val());
$('.Shipping input[id*=_DSG1]').val($('.Street input[id*=_DSG1]').val());
$('.Shipping input[id*=_DSG2]').val($('.Street input[id*=_DSG2]').val());
$('.Shipping input[id*=_DSG3]').val($('.Street input[id*=_DSG3]').val());
$('.Shipping input[id*=_DSG4]').val($('.Street input[id*=_DSG4]').val());
}
else {
$('.Shipping input').val('');
}
});
});
// End Copy Mailing Address
I used Street for the CSS Class for the first address
I used Shipping for the CSS Class for the Shipping address
I used AddrSame for the CSS Class for the Yes/No button
I added a Radio Button with "Yes", "No" to toggle with the CSSClass of "AddrSame"
This is what I came up with for mine:
// Copy Mailing Address
$(document).ready(function () {
$('.AddrSame').click(function () {
if($('input[value="Yes"]').is(':checked')){
$('.ShipStreet input').val($('.Street input').val());
$('.ShipCity input').val($('.City input').val());
$('.ShipState input').val($('.State input').val());
$('.ShipZip input').val($('.Zip input').val());
}
else {
$('.ShipStreet input').val('');
$('.ShipCity input').val('');
$('.ShipState input').val('');
$('.ShipZip input').val('');
}
});
});
// End Copy Mailing Address
I tried it, and it did not work for me. I am using Forms 10
What do you have for your Vendor Address css class, and your Ship to address css class?
I have for the CSSClass vendor address (all case sensitive):
Street
City
State
Zip
For the shipping Class:
ShipStreet
ShipCity
ShipState
ShipZip
You can add Street2 and ShipStreet2 Classes to add the Address2 line
I am Sorry, I totally misunderstood where you were going! I thought you were using single lines and CSS not the address field.
Thanks! This post really helped me out.