{"id":96,"date":"2019-01-02T02:44:38","date_gmt":"2019-01-02T02:44:38","guid":{"rendered":"https:\/\/people.utm.my\/zuraida\/?p=96"},"modified":"2019-01-02T02:44:38","modified_gmt":"2019-01-02T02:44:38","slug":"javascript-form-validation","status":"publish","type":"post","link":"https:\/\/people.utm.my\/zuraida\/2019\/01\/02\/javascript-form-validation\/","title":{"rendered":"JavaScript Form Validation"},"content":{"rendered":"<p>&lt;!DOCTYPE html&gt;<br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;script&gt;<br \/>\nfunction validateForm() {<br \/>\nvar x = document.forms[&#8220;myForm&#8221;][&#8220;fname&#8221;].value;<br \/>\nif (x == &#8220;&#8221;) {<br \/>\nalert(&#8220;Name must be filled out&#8221;);<br \/>\nreturn false;<br \/>\n}<br \/>\n}<br \/>\n&lt;\/script&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<\/p>\n<p>&lt;form name=&#8221;myForm&#8221; action=&#8221;\/action_page.php&#8221; onsubmit=&#8221;return validateForm()&#8221; method=&#8221;post&#8221;&gt;<br \/>\nName: &lt;input type=&#8221;text&#8221; name=&#8221;fname&#8221;&gt;<br \/>\n&lt;input type=&#8221;submit&#8221; value=&#8221;Submit&#8221;&gt;<br \/>\n&lt;\/form&gt;<\/p>\n<p>&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-97\" src=\"https:\/\/people.utm.my\/zuraida\/wp-content\/uploads\/sites\/1098\/2019\/01\/form.png\" alt=\"\" width=\"643\" height=\"321\" srcset=\"https:\/\/people.utm.my\/zuraida\/wp-content\/uploads\/sites\/1098\/2019\/01\/form.png 643w, https:\/\/people.utm.my\/zuraida\/wp-content\/uploads\/sites\/1098\/2019\/01\/form-300x150.png 300w, https:\/\/people.utm.my\/zuraida\/wp-content\/uploads\/sites\/1098\/2019\/01\/form-500x250.png 500w\" sizes=\"auto, (max-width: 643px) 100vw, 643px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script&gt; function validateForm() { var x = document.forms[&#8220;myForm&#8221;][&#8220;fname&#8221;].value; if (x == &#8220;&#8221;) { alert(&#8220;Name must be filled out&#8221;); return false; } } &lt;\/script&gt; &lt;\/head&gt; &lt;body&gt; &lt;form name=&#8221;myForm&#8221; action=&#8221;\/action_page.php&#8221; onsubmit=&#8221;return validateForm()&#8221; method=&#8221;post&#8221;&gt; Name: &lt;input type=&#8221;text&#8221; name=&#8221;fname&#8221;&gt; &lt;input &hellip; <a href=\"https:\/\/people.utm.my\/zuraida\/2019\/01\/02\/javascript-form-validation\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":14456,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-96","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/people.utm.my\/zuraida\/wp-json\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/people.utm.my\/zuraida\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/people.utm.my\/zuraida\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/people.utm.my\/zuraida\/wp-json\/wp\/v2\/users\/14456"}],"replies":[{"embeddable":true,"href":"https:\/\/people.utm.my\/zuraida\/wp-json\/wp\/v2\/comments?post=96"}],"version-history":[{"count":0,"href":"https:\/\/people.utm.my\/zuraida\/wp-json\/wp\/v2\/posts\/96\/revisions"}],"wp:attachment":[{"href":"https:\/\/people.utm.my\/zuraida\/wp-json\/wp\/v2\/media?parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/people.utm.my\/zuraida\/wp-json\/wp\/v2\/categories?post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/people.utm.my\/zuraida\/wp-json\/wp\/v2\/tags?post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}