/    Sign up×
Community /Pin to ProfileBookmark

Copying shipping info same as billing state field not working

Hello all,

I am trying to copy the billing information to be the same as the shipping information when they select the checkbox. Everything seems to work except for the State field which is a drop down. Depending on what country they select, the state field will automatically populate.

Does anyone know how I can copy the billing state to be the same as shipping as well?

Text file attached.

Thanks in advance.

[upl-file uuid=624b6e8d-bd4a-41d1-b18b-9b85520b985c size=51kB]code.txt[/upl-file]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@FangDec 07.2009 — form.Bill_To_State.options[0]=new Option(form.Ship_To_State.options[form.Ship_To_State.selectedIndex].text, form.Ship_To_State.value);
Copy linkTweet thisAlerts:
@llckllauthorDec 07.2009 — <i>
</i>
form.Bill_To_State.options[0]=new Option(form.Ship_To_State.options[form.Ship_To_State.selectedIndex].text, form.Ship_To_State.value);


[/QUOTE]


Thank you Fang. It worked great.

I just don't want other people to solve my problems, so can you help me understand the code and how it works?

[LIST=1]
  • [*]Creating a new bill to state object

  • [*]giving it the value of the ship to state option index + the text

  • [*]form.ship_to_State.value <--- what is this for?

  • [/LIST]


    Thanks in advance.
    Copy linkTweet thisAlerts:
    @FangDec 08.2009 — 
  • 1. It replaces the single option with a new one.


  • 2. This refers to the text value(what the user sees) [I]<option value="United States">[COLOR="Navy"]United States[/COLOR]</option>[/I]


  • 3. This refers to the value attribute. [I]<option value="[COLOR="Navy"]United States[/COLOR]">United States</option>[/I]
  • ×

    Success!

    Help @llckll spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...