{"id":242,"date":"2010-06-23T14:45:54","date_gmt":"2010-06-23T18:45:54","guid":{"rendered":"http:\/\/erics-test-lab.com\/?p=242"},"modified":"2010-06-23T14:45:54","modified_gmt":"2010-06-23T18:45:54","slug":"javascript-objects-and-methods","status":"publish","type":"post","link":"https:\/\/www.esearing.com\/v2010\/2010\/06\/javascript-objects-and-methods\/","title":{"rendered":"Javascript Objects and Methods"},"content":{"rendered":"<p>I have a lovely form that allows me to add_new records, edit records, or delete records for a database table. What was missing was an extra submit button to allow me to edit an existing record and save it as a new record.  Piece of cake! I&#8217;ve done it many times. Until today. <!--more-->Today I get the VAGUE Javascript error message: <strong>&#8220;Object or Method not supported on line 34 blah blah blah&#8230;&#8221;<\/strong><\/p>\n<p><code>function savenew(){<br \/>\ndocument.formname.fieldname.value=\"add\";<br \/>\nwith(document.formname){<br \/>\n         action=\"myaddnewpage.cfm\";  \/\/ line 34...this is the bit the error is pointing to.<br \/>\n         method=\"post\";<br \/>\n         submit();<br \/>\n     }<br \/>\n}<\/code><br \/>\nWhat do you mean I can&#8217;t use action = someurl. I do it all the time!!! ARGGGGG. But then I found an obscure bit of documentation that claims you can not use the action object if you have it as an object named &#8220;action&#8221; later in the document. Well, lo and behold I have a database column called action so I simply named the corresponding form element &#8220;action&#8221; . Renamed it to &#8220;f_action&#8221; and it works just fine.<\/p>\n<p><code>&lt;select name=\"f_action\">...<\/code><br \/>\nBut since I didn&#8217;t want to go update all the functions throughout the tool where that might occur I merely omitted the action and method statement in my function and used the form tag  attributes for the action url and method.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a lovely form that allows me to add_new records, edit records, or delete records for a database table. What was missing was an extra submit button to allow me to edit an existing record and save it as &hellip; <a href=\"https:\/\/www.esearing.com\/v2010\/2010\/06\/javascript-objects-and-methods\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,21],"tags":[27],"class_list":["post-242","post","type-post","status-publish","format-standard","hentry","category-code","category-problems-fixes","tag-javascript-errors"],"_links":{"self":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/comments?post=242"}],"version-history":[{"count":0,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/242\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/media?parent=242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/categories?post=242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/tags?post=242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}