You are viewing limited content. For full access, please sign in.

Question

Question

What is the best way to populate address if Vendor Address and Shipping address is the same on a Form?

asked on April 28, 2016 Show version history

I was thinking of putting a check box that states, "Check if address is same as above"

Address Populate.PNG
0 0

Replies

replied on April 29, 2016

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

Address.PNG
Address.PNG (17.3 KB)
1 0
replied on April 28, 2016

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  
 

0 0
replied on April 28, 2016

I tried it, and it did not work for me. I am using Forms 10

0 0
replied on April 28, 2016

What do you have for your Vendor Address css class, and your Ship to address css class?

0 0
replied on April 28, 2016

0 0
replied on April 29, 2016 Show version history

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

0 0
replied on April 29, 2016 Show version history

I am Sorry, I totally misunderstood where you were going!  I thought you were using single lines and CSS not the address field.

 

0 0
replied on May 18, 2017

Thanks! This post really helped me out.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.