{"id":889,"date":"2015-06-03T09:50:14","date_gmt":"2015-06-03T09:50:14","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=889"},"modified":"2015-06-08T05:23:49","modified_gmt":"2015-06-08T05:23:49","slug":"form-reset-wont-work-for-hidden-field","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/form-reset-wont-work-for-hidden-field\/","title":{"rendered":"Form reset wont work for hidden field"},"content":{"rendered":"<p><strong>1.Form reset javascript does not work for hidden field<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n function resetForm()\r\n {\r\n   document.getElementById(&quot;SetUpForm&quot;).reset();\r\n }\r\n <\/pre>\n<p>The reset() functionality in javascript  is intended for clearing user input, and since hidden inputs are not directly accessible by the user, it doesn&#8217;t make sense to allow the user to reset the hidden input&#8217;s value.<\/p>\n<p><strong>2.Dropdown should be reset by Javascript if selected is used.<\/strong><br \/>\nThe Same way this does not work in dropdown where the value is set to selected.The values of the dropdown should be manually reset by adding below code to above<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n function resetForm()\r\n {\r\n   document.getElementById(&quot;SetUpForm&quot;).reset();\r\n\r\n   $(&quot;#cboAge&quot;).val('');\r\n   $(&quot;#cboCity&quot;).val('');\r\n }\r\n <\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1.Form reset javascript does not work for hidden field function resetForm() { document.getElementById(&quot;SetUpForm&quot;).reset(); } The reset() functionality in javascript is intended for clearing user input, and since hidden inputs are not directly accessible by the user, it doesn&#8217;t make sense to allow the user to reset the hidden input&#8217;s value. 2.Dropdown should be reset by&hellip; <a href=\"https:\/\/codethataint.com\/blog\/form-reset-wont-work-for-hidden-field\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[156],"tags":[],"class_list":["post-889","post","type-post","status-publish","format-standard","hentry","category-form"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/889","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=889"}],"version-history":[{"count":5,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/889\/revisions"}],"predecessor-version":[{"id":895,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/889\/revisions\/895"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}