{"id":1939,"date":"2022-08-30T15:20:42","date_gmt":"2022-08-30T15:20:42","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/05\/when-bind-view-model-attribute-to-a-input-textbox-it-crashes-in-ie-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:20:42","modified_gmt":"2022-08-30T15:20:42","slug":"when-bind-view-model-attribute-to-a-input-textbox-it-crashes-in-ie-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/when-bind-view-model-attribute-to-a-input-textbox-it-crashes-in-ie-collection-of-common-programming-errors\/","title":{"rendered":"When bind view model attribute to a input textbox, it crashes in IE-Collection of common programming errors"},"content":{"rendered":"<p>Assuming that you are getting some results back of type Stakeholder and storing them in searchResults &#8211;<\/p>\n<table data-bind=\"with: searchResults\">\n<tr>\n<th><\/th>\n<\/tr>\n<tr>\n<td>Name<\/td>\n<td>Org Name<\/td>\n<\/tr>\n<tr data-bind=\"foreach: stakeholder\">\n<td data-bind=\"text: name\"><\/td>\n<td><\/td>\n<\/tr>\n<\/table>\n<p>Works in IE8. But since your searchResults is a KO.observableArray() I assume that you need to foreach your searchResults, but without a better picture of what you are doing it&#8217;s hard to tell, here that is anyway.<\/p>\n<table>\n<tr>\n<th><\/th>\n<\/tr>\n<tr>\n<td>Name<\/td>\n<td>Org Name<\/td>\n<\/tr>\n<tr data-bind=\"foreach: searchResults\">\n<td data-bind=\"text: name\"><\/td>\n<td><\/td>\n<\/tr>\n<\/table>\n<p>I also can&#8217;t tell what orgName is or how it is being passed to the constructor of the Stakeholder, if it is a KO.observable then remove it as a parameter and use orgName(), if it is a parameter being passed in then move it up to the parent function and rename it to ensure it isn&#8217;t a circular reference.<\/p>\n<pre><code>var Stakeholder = (function (organizationName) {\n    var self = this;\n    function Stakeholder() {\n        this.orgName = ko.observable(self.organizationName);\n    };\n    return Stakeholder;\n})();\n<\/code><\/pre>\n<p>Last, not sure what the &#8216;blah&#8217; element is at the bottom, maybe just a copy pasta typo?<\/p>\n<p id=\"rop\"><small>Originally posted 2013-12-05 09:42:06. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Assuming that you are getting some results back of type Stakeholder and storing them in searchResults &#8211; Name Org Name Works in IE8. But since your searchResults is a KO.observableArray() I assume that you need to foreach your searchResults, but without a better picture of what you are doing it&#8217;s hard to tell, here that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1939","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1939","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1939"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1939\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}