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 7780263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:50:42+00:00 2026-06-01T18:50:42+00:00

I’m using the mapping plugin to create my client side view model based on

  • 0

I’m using the mapping plugin to create my client side view model based on an object that gets sent from the server. The object is basic address information ie: address1, address2, city, state, postal, ect…

Once the view model is bound, I want a google maps canvas to update if the user changes the address. I created a computed observable that checks the values entered and calls a map update function. I had this working before when I wasn’t using the mapping plugin, ie model was defined locally, but once I introduced mapping I wasn’t able to append the computed observable to the view model.

I tried following the instructions from the mapping plugin documentation, but the computed observable isn’t triggering updates. I have a custom mapping that calls a mapModel which contains the computed observable as in the examples, but no updates.

Any ideas?

$.getJSON("@Url.RouteUrl("
ContactUs_default ", new { action = "
GetPageModel ",  Model.BusinessID})", function(result) {
    //create map property
    result.Data.Map = null;
    var mapping = {
        'Map': {
            create: function(options) {
                return new mapModel(options.data);
            }
        }
    };

    var viewModel = ko.mapping.fromJS(result.Data, mapping);    

    ko.applyBindings(viewModel);

});

var mapModel = function(data) {
    ko.mapping.fromJS(data, {}, this);

    this.Map = ko.computed(function() {
        var address = "";
        var enteredElements = 0;

        if (this.Address1 != helpText) {
            address += " " + this.Address1;
            enteredElements++;
        }

        if (this.Address2 != helpText) {
            address += " " + this.Address2;
        }

        if (this.City != helpText) {
            address += " " + this.City;
            enteredElements++;
        }

        if (this.State != helpText) {
            address += " " + this.County;
            enteredElements++;
        }

        if (this.PostalCode != helpText) {
            address += " " + this.Postal;
        }
        alert("hi");

        //only upate map if enough data has been entered to give accruate location
        if (enteredElements >= 3) {
            MYMAP.placeMarkers(address);
        }
    }, this);
};​
  • 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-01T18:50:43+00:00Added an answer on June 1, 2026 at 6:50 pm

    When you send your data through the mapping plugin, all of your properties will become observables.

    This means that you need to access them as a function like like:

        if (this.Address1() != helpText) {
            address += " " + this.Address1();
            enteredElements++;
        }
    

    When you access them as observables inside of a computed observables, then it will create a dependency. So, currently your computed observable would get initially evaluated, but it would never update again, as it does not access the value of any observables.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.