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

  • SEARCH
  • Home
  • 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 8221859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:04:53+00:00 2026-06-07T14:04:53+00:00

I have a form for editing a provider record. The provider record has a

  • 0

I have a form for editing a provider record. The provider record has a relationship with multiple address, so a provider can has home, office, vacation, etc address types.

The json addresses object that comes from server just brings the addresses that the provider has, so if the provider has only a “vacation” type address then that’s the only record that comes in but in the editing form I must have to have all the addresses types in order to edit the existing ones or add a new one.

I don’t know if my approach is fine but I have in my form a “jsonBaseAddresses” that contains all the address possible types and this object is binded using Knockout to the form (this actually works) so I want to merge the “jsonRemoteAddress” with “jsonBaseAddresses” in order to have the “jsonBaseAddresses” but merged with the data that comes in the remote json object.

Again, i dont know if this is the right way to do it. Appreciate any help. Here is a jsFiddle sample of what i want to do.

http://jsfiddle.net/HJrGf/4/

Thanks

  • 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-07T14:04:56+00:00Added an answer on June 7, 2026 at 2:04 pm

    Why don’t you just iterate over the remote addresses and push them to addresses in the view model like ?

    var vm = new App(jsonBaseAddresses );
    for ( var i = 0; i < jsonRemoteAddresses.length; i++){
    vm.addresses.push(new Address(jsonRemoteAddresses[i]);
    }
    

    And so on …

    To merge addresses you can use following solutions:

    1. You can introduce property to Address like Equals and compare fields
      that identify the unique address

    2. Select any implementation in this post How to determine equality for two JavaScript objects?
      to get the address hash code and in the loop above compare the hash
      codes of the addresses to merge. I used this solution in one of my
      projects. And also check this http://documentcloud.github.com/underscore/#isEqual

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

Sidebar

Related Questions

I have a form that handles editing of a domain model (A). This domain
I have a page on my site with a form for editing event information
I have a longish form that scrolls vertically and also allows editing records. When
I have created a form that is used for both adding and editing a
I have form where user submits field. Field can have letters, numbers, and punctuation.
I have form, where some fields are looks like rows, so I can add/delete
Let's say I have a form for adding/editing products (with field 'user' being a
I have a jqGrid that has add/edit dialogs with a form that's longer than
In a Rails application, I have a particular form with many fields for editing
I have a Rails form for editing objects of a particular class. The labels

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.