{"id":12054,"date":"2015-02-01T05:05:30","date_gmt":"2015-01-31T18:05:30","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=12054"},"modified":"2015-05-17T16:22:25","modified_gmt":"2015-05-17T06:22:25","slug":"html-form-multiple-submit-buttons-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-form-multiple-submit-buttons-primer-tutorial\/","title":{"rendered":"HTML Form Multiple Submit Buttons Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/multiple_form_submit_buttons.html\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"HTML Form Multiple Submit Buttons Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Quiz\/multiple_form_submit_buttons.jpg\" title=\"HTML Form Multiple Submit Buttons Primer Tutorial\"    \/><\/a><p class=\"wp-caption-text\">HTML Form Multiple Submit Buttons Primer Tutorial<\/p><\/div>\n<p>Today we want to discuss a very old HTML concept called the <a target=_blank title='HTML form tag information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_form.asp'><i>form<\/i><\/a> tag which allows for the processing of interactive input from the user in the form of textboxes and checkboxes and radio buttons and buttons to transfer information from one webpage to another, somewhere.<\/p>\n<p>For clarity, today, we only use buttons, and you may ask, <i>&#8220;What good are buttons on their own for imparting information?&#8221;<\/i> &#8230; and will ignore the obvious answer that a button press anywhere, depending on the event logic, can mean so much &#8230; after all, we all envisaged the disaster of a nuclear holocaust envisaging the press of one button &#8230; no, we want to talk about the idea that you can have more than one <i>input<\/i> tag with <i>type=&#8217;submit&#8217;<\/i> &#8230; and this was not always the case, because in the early days of HTML there was the one <a target=_blank title='HTML input tag type=submit button information from w3schools' href='http:\/\/www.w3schools.com\/html\/html_forms.asp'><i>submit button<\/i><\/a> allowed on one HTML form &#8230; now you can even have more than one <i>form<\/i> &#8230; but this is for another day.<\/p>\n<p>Anyway, you might still ask, anyway, <i>&#8220;Ignoring the huge event logic possibilities of a button press (because you are not trying to trick me here), what good are buttons on their own for imparting information?&#8221;<\/i> &#8230; well, it means on the <a target=_blank title='callback information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Callback_%28computer_programming%29'><i>callback<\/i><\/a> &#8230; and today we just callback the same HTML code (via the <i>form<\/i>&#8216;s <i>action=<\/i> designation of itself, today) &#8230; as we often like to do at this blog, by the way &#8230; we can compartmentalize via the <i>GET<\/i> (in our form&#8217;s <i>method<\/i> case &#8230; for starters, with <i>POST<\/i> we&#8217;d need <a target=_blank title='Ajax information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Ajax_%28programming%29'>Ajax<\/a> or a server language, and remember we are trying to keep things more basic here) parameters in the <i>callback<\/i> URL (stored in &#8220;Javascript DOM land&#8221; as <a target=_blank title='Javascript DOM document.URL information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/prop_doc_url.asp'><i>document.URL<\/i><\/a>) according to the <i>value<\/i> of that <i>submit button<\/i> whose <i>name<\/i> becomes that <i>GET<\/i> parameter&#8217;s name &#8230; so that for an HTML <i>form<\/i>&#8216;s <i>submit button<\/i> like &#8230;<\/p>\n<p><code><br \/>\n&lt;input type='submit' title='Submit of form to an embedded iframe' onclick='cif();' name='submitiframe' id='submitiframe' value='Validate and Iframe'&gt;&lt;\/input&gt;<br \/>\n<\/code><\/p>\n<p>&#8230; its contributing part of the <i>callback<\/i> URL, in our code, is &#8230;<\/p>\n<p><code><br \/>\n... ?submitiframe=Validate+and+Iframe ...<br \/>\n<\/code><\/p>\n<p>&#8230; and so we can, in Javascript, at the <a target=_blank title='HTML body onload event information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/event_onload.asp'><i>onload<\/i> event<\/a>&#8216;s code &#8230; have an <i>else if<\/i> statement like &#8230;<\/p>\n<p><code><br \/>\n  } else if (document.URL.indexOf('iframe=') != -1) {<br \/>\n    \/\/ do something here<br \/>\n  }<br \/>\n<\/code><\/p>\n<p>&#8230; to have a good compartmentalizing of &#8220;action&#8221; segments of code that is quite readable and understandable.<\/p>\n<p>If the case is not clear &#8230; please tee up a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/multiple_form_submit_buttons.html\" title='Click picture'>live run<\/a> with the HTML programming source code <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/multiple_form_submit_buttons.html_GETME\" title='multiple_form_submit_buttons.html'>multiple_form_submit_buttons.html<\/a>   &#8230; or else please try some HTML code yourself &#8230; the hardest concept here today is the embedding of an <a target=_blank title='HTML iframe tag' href='http:\/\/www.w3schools.com\/tags\/tag_iframe.asp'>iframe<\/a> in a hierarchical way (note the Javascript DOM manipulation of the <i>form<\/i>&#8216;s <i>target=<\/i> designation, as you examine the downloadable code above), and so for clarity we preface any iframe by a current client (ie. Javascript) timestamp, so you know who inherits who etcetera etcetera etcetera.<\/p>\n<p>Now even after all this, you may want to say, <i>&#8220;So what &#8230; an HTML <a target=_blank title='HTML a tag information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_a.asp' style='text-decoration:none;'><b>a<\/b><\/a> tag link can do all this.<\/i> &#8230; to which we say &#8230; that&#8217;s true &#8230; good to know there is more than one way to &#8220;skin a cat&#8221; &#8230; meowwwwwwww! &#8230; <font style='font-family:courier-new;' size=1>&#8220;no animals were harmed in the making of this tutorial&#8221;<\/font>.<\/p>\n<p>In fact you could go on and on and on with possibilities for the equivalent means by which to achieve the ends we have here with our HTML, such as using an <i>input<\/i> <i>type=&#8221;button&#8221;<\/i> or in HTML5, a <a target=_blank title='HTML5 button tag information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_button.asp'><i>button<\/i><\/a> tag, and all these and more and more and more and more are worth exploring, and trying, yourself, or by researching the subject.   One day, in a real bind, with cross-browser issues, you may need that extra method, to make things work for all the platforms?!<\/p>\n<p><b><i>Did you know?<\/i><\/b><\/p>\n<p>With an HTML <i>input<\/i> <i>type=&#8221;submit&#8221;<\/i> (submit button), there is nothing stopping you storing more than just the &#8220;front look&#8221; of the button in its <i>value<\/i>= parameter.   If you want to do this, but there is no way you want to show that &#8220;data&#8221; as the &#8220;front look&#8221; of the button, perhaps it really should be an <a target=_blank title='input type=hidden information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/dom_obj_hidden.asp'><i>input<\/i> <i>type=&#8221;hidden&#8221;<\/i><\/a> piece of data, or you should hide it &#8230; via <a target=_blank title='style=display:none information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/prop_style_display.asp'><i>style=&#8221;display:none;&#8221;<\/i><\/a> &#8230; Javascript DOM store data to it via <i>document.getElementById([itsID]).value=[myData];<\/i> &#8230; and, conditionally perhaps, click it via Javascript, via <i>document.getElementById([itsID]).<a target=_blank title='Javascript DOM click() method' href='http:\/\/www.w3schools.com\/jsref\/met_html_click.asp'>click()<\/a>;<\/i> method.\n<\/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='#d12054' onclick='var dv=document.getElementById(\"d12054\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=HTML\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d12054' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Today we want to discuss a very old HTML concept called the form tag which allows for the processing of interactive input from the user in the form of textboxes and checkboxes and radio buttons and buttons to transfer information &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/html-form-multiple-submit-buttons-primer-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,17,37],"tags":[174,327,354,452,549,576,652,997,1215,1319],"class_list":["post-12054","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-gui","category-tutorials","tag-button","tag-did-you-know","tag-dom","tag-form","tag-gui","tag-html","tag-javascript","tag-programming","tag-submit-button","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/12054"}],"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=12054"}],"version-history":[{"count":1,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/12054\/revisions"}],"predecessor-version":[{"id":14889,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/12054\/revisions\/14889"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=12054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=12054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=12054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}