{"id":344,"date":"2010-08-10T13:46:51","date_gmt":"2010-08-10T17:46:51","guid":{"rendered":"http:\/\/erics-test-lab.com\/?p=344"},"modified":"2010-08-10T13:46:51","modified_gmt":"2010-08-10T17:46:51","slug":"select-option-0-value","status":"publish","type":"post","link":"https:\/\/www.esearing.com\/v2010\/2010\/08\/select-option-0-value\/","title":{"rendered":"Select option [0] value"},"content":{"rendered":"<p>I have an application that allows the user to look up order detail. When they click on that order number they can open a trouble ticket.<br \/>\nI pass most of the order information to the trouble ticket which is built on the fly based on how they answer questions. In some cases I need to collect the data again but allow them to change it. It was easy enough for input boxes but selects gave me some trouble. <\/p>\n<p>Here is what i ended up with. TR_SEGMENT is what I passed from the order into a hidden formfield. I then reset the initial Select option for segment &#8211; Normally &#8220;Select One&#8221; with this value. I have to check and see if the form element segment is there first then update the value and the display text.<\/p>\n<p><code>javascript<br \/>\nif(document.qform.segment != null && document.qform.segment != 'undefined'<br \/>\n&& document.qform.TR_SEGMENT.value != 'undefined'){<br \/>\ndocument.qform.segment[0].value = document.qform.TR_SEGMENT.value;<br \/>\ndocument.qform.segment[0].text = document.qform.TR_SEGMENT.value;<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have an application that allows the user to look up order detail. When they click on that order number they can open a trouble ticket. I pass most of the order information to the trouble ticket which is built &hellip; <a href=\"https:\/\/www.esearing.com\/v2010\/2010\/08\/select-option-0-value\/\">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,12,24],"tags":[],"class_list":["post-344","post","type-post","status-publish","format-standard","hentry","category-code","category-javascript","category-snippets-quick-code-tips-for-single-elements-attributes-or-details"],"_links":{"self":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/344","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=344"}],"version-history":[{"count":0,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/posts\/344\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/media?parent=344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/categories?post=344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esearing.com\/v2010\/wp-json\/wp\/v2\/tags?post=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}