{"id":51639,"date":"2021-02-08T03:01:51","date_gmt":"2021-02-07T17:01:51","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=51639"},"modified":"2021-02-07T20:34:14","modified_gmt":"2021-02-07T10:34:14","slug":"html-form-onsubmit-event-appending-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-form-onsubmit-event-appending-tutorial\/","title":{"rendered":"HTML Form Onsubmit Event Appending Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/onsubmit_appending.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"HTML Form Onsubmit Event Appending Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/onsubmit_appending.jpg\" title=\"HTML Form Onsubmit Event Appending Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">HTML Form Onsubmit Event Appending Tutorial<\/p><\/div>\n<p>There&#8217;s a &#8220;proof of concept&#8221; web application we&#8217;re interested in, with this recent focus on HTML form validation.  That validation, on the client side, relies on a form &#8220;onsubmit&#8221; event.  Our question is &#8230;<\/p>\n<blockquote><p>\nCan the &#8220;onsubmit&#8221; event logic be added to, dynamically, by the Javascript?\n<\/p><\/blockquote>\n<p>And, today, as we suspected, &#8220;yes&#8221;, it can be done, in a bit of a kludgy feeling way, mainly kludgy feeling regarding, at least for us &#8230;<\/p>\n<ul>\n<li>the use of Javascript <a target=_blank href='http:\/\/www.w3schools.com\/jsref\/jsref_eval.asp' title='Javascript eval'>eval<\/a><\/li>\n<li>keeping existant logic hardcoded already from the HTML design, before any Javascript, could be imperfect, relying on a last &#8220;return&#8221; statement being the place before which any new dynamic &#8220;onsubmit&#8221; event logic snippets are slotted in<\/li>\n<\/ul>\n<p>Nevertheless, the idea of dynamically adding to the HTML form &#8220;onsubmit&#8221; logic, depending on some information related to that form&#8217;s navigational &#8220;textbox&#8221; (or other HTML elements) data, sounds interesting to us, as a validation coding tool of interest.<\/p>\n<p>Today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/onsubmit_appending.jpg\" title=\"Tutorial picture\">tutorial picture<\/a> relates code with outcomes for this &#8220;first draft proof of concept&#8221; <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/onsubmit_appending.html_GETME\">onsubmit_appending.html<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/onsubmit_appending.html\" title=\"Click picture\">live run<\/a> you can try for yourself below &#8230;<\/p>\n<p><iframe src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/onsubmit_appending.html\" style=\"width:100%;height:500px;\"><\/iframe><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d51639' onclick='var dv=document.getElementById(\"d51639\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/onsubmit\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d51639' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>There&#8217;s a &#8220;proof of concept&#8221; web application we&#8217;re interested in, with this recent focus on HTML form validation. That validation, on the client side, relies on a form &#8220;onsubmit&#8221; event. Our question is &#8230; Can the &#8220;onsubmit&#8221; event logic be &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-form-onsubmit-event-appending-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,37],"tags":[2236,399,400,452,576,652,3373,830,1712,997,1675,1319,1358],"class_list":["post-51639","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-append","tag-eval","tag-event","tag-form","tag-html","tag-javascript","tag-logic","tag-navigation","tag-onsubmit","tag-programming","tag-textbox","tag-tutorial","tag-validation"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/51639"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=51639"}],"version-history":[{"count":3,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/51639\/revisions"}],"predecessor-version":[{"id":51642,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/51639\/revisions\/51642"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=51639"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=51639"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=51639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}