Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8659841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:06:16+00:00 2026-06-12T16:06:16+00:00

I am trying to copy one observably array to another observable array. I have

  • 0

I am trying to copy one observably array to another observable array. I have a form that has a billing address, shipping address and checkbox that when clicked allows the user to copy all of their shipping info to their billing address. The problem I am having is when I copy one observable array to another, then any time I make a change to either observable both observable arrays get updated. I would like to keep both observable array values seperate just copy the values from one to the other.

My observable arrays are set up using the mapping plugin:

self.billingAddress = ko.mapping.fromJS(InitialEmptyAddressModel);
self.shippingAddress = ko.mapping.fromJS(InitialEmptyAddressModel);

Then to copy shipping info to billing after entering shipping information and clicking on ‘Use Shipping Address’:

 self.CopyAddress = function() {
    self.billingAddress(self.shippingAddress());
    }

I’ve also tried the following:
What is the best way of cloning/copying an observablearray in knockoutJS?

Any help would be appreciated thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:06:17+00:00Added an answer on June 12, 2026 at 4:06 pm

    You don’t really want to copy over the observables that are inside shippingAddress. You would likely want to get a clean version of it and then apply it to the other mapped object.

    Something like:

    self.copyAddress = function() {
        var clean = ko.mapping.toJS(self.shippingAddress);
        ko.mapping.fromJS(clean, self.billingAddress);
    };
    

    Sample: http://jsfiddle.net/rniemeyer/NdS5M/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to copy one array to another: NSMutableArray *itemsCopy = [[NSMutableArray alloc]
I'm trying to copy one form <input> field value to another form using jQuery.
Hi I'm trying to copy one row from DataTable to another, I looked almost
I am trying to copy a column from one sheet to another. The code
Basically I'm trying to copy a file from one place to another but I
I'm trying to copy the <options> HTML Codes from one select list to another.
Greetings, I am trying to perform a copy from one vector (vec1) to another
I'm trying to copy the contents of one table into another in Postgres, however
I'm trying to copy SQL database from one server to another. Please tell me
I am trying to copy an excel sheet from one workbook to another without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.