{"id":65792,"date":"2021-07-14T04:10:06","date_gmt":"2021-07-14T08:10:06","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/javascript-form-validation-javascript\/"},"modified":"2021-07-14T04:10:06","modified_gmt":"2021-07-14T08:10:06","slug":"javascript-form-validation-javascript","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=65792","title":{"rendered":"JavaScript &#8211; Form validation #JavaScript"},"content":{"rendered":"<p>The code will be helpful in validating data entry forms such as: user registration, user creati on. validate_required is used by all other functions<\/p>\n<pre>function validate_required(field,alerttxt)\r\n\t{\r\n\t\twith (field)\r\n\t\t{\r\n\t\t\tif (value==null||value=='')\r\n\t\t\t{\r\n\t\t\t\talert(alerttxt);return false\r\n\t\t\t}\r\n\t\t\telse {return true}\r\n\t\t}\r\n\t}\r\n\t\r\n\tfunction validateTicketCreateForm(thisform)\r\n\t{\r\n\t\twith (thisform)\r\n\t\t{\r\n\t\t\tif (validate_required(type,'Type must be filled out!')==false)\r\n\t\t\t{type.focus();return false}\r\n\t\t\t\r\n\t\t\tif (validate_required(subject,'Subject must be filled out!')==false)\r\n\t\t\t{subject.focus();return false}\r\n\t\t\t\t\t\t\r\n\t\t}\r\n\t}\r\n\r\n\tfunction validate_customer_create_form(thisform)\r\n\t{\r\n\t\twith (thisform)\r\n\t\t{\r\n\t\t\tif (validate_required(firstName,'First name must be filled out!')==false)\r\n\t\t\t{firstName.focus();return false}\r\n\t\t\t\r\n\t\t\tif (validate_required(lastName,'Last name must be filled out!')==false)\r\n\t\t\t{lastName.focus();return false}\r\n\t\t\t\r\n\t\t\tif (validate_required(phone,'Phone must be filled out!')==false)\r\n\t\t\t{phone.focus();return false}\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\t\r\n\t\r\n\tfunction validateUserCreateForm(thisform)\r\n\t{\r\n\t\twith (thisform)\r\n\t\t{\r\n\t\t\t\t\t\t\r\n\t\t\tif (validate_required(firstName,'First name must be filled out!')==false)\r\n\t\t\t{firstName.focus();return false}\r\n\t\t\t\r\n\t\t\tif (validate_required(lastName,'Last name must be filled out!')==false)\r\n\t\t\t{lastName.focus();return false}\r\n\t\t\t\r\n\t\t\tif (validate_required(shortName,'Short name must be filled out!')==false)\r\n\t\t\t{shortName.focus();return false}\r\n\t\t\t\r\n\t\t\tif (validate_required(username,'Username must be filled out!')==false)\r\n\t\t\t{username.focus();return false}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\tif (validate_required(password,'Password must be filled out!')==false)\r\n\t\t\t{password.focus();return false}\r\n\t\t\t\r\n\t\t\tif (password.value.length &lt; passwordLength.value) {alert(\"Password must be\r\n              at least \" + passwordLength.value +\" char long\");\r\n\tpassword.focus();return false}\r\n\t\t\t\r\n\t\t\tif (validate_required(password2,'Please re-enter password!')==false)\r\n\r\n\t\t\t{password2.focus();return false}\r\n\t\t\t\r\n\t\t\tif (password.value != password2.value)\r\n\t\t\t{\r\n\t\t\t\t\r\nalert(\"Password did not match\");\r\n\r\n\t\t\t\tpassword2.focus();\r\n\t\t\t\treturn false\t\t\t\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n<\/pre>\n<p> From: http:\/\/sitestree.com\/?p=3475<br \/> Categories:JavaScript<br \/>Tags:<br \/> Post Data:2016-07-09 20:36:29<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The code will be helpful in validating data entry forms such as: user registration, user creati on. validate_required is used by all other functions function validate_required(field,alerttxt) { with (field) { if (value==null||value==&#8221;) { alert(alerttxt);return false } else {return true} } } function validateTicketCreateForm(thisform) { with (thisform) { if (validate_required(type,&#8217;Type must be filled out!&#8217;)==false) {type.focus();return false} &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=65792\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-65792","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":70133,"url":"http:\/\/bangla.sitestree.com\/?p=70133","url_meta":{"origin":65792,"position":0},"title":"Javascript &#8211; Form validation #13","author":"Author-Check- Article-or-Video","date":"August 27, 2021","format":false,"excerpt":"The code will be helpful in validating data entry forms such as: user registration, user creation. validate_required is used by all other functionsfunction validate_required(field,alerttxt) { with (field) { if (value==null||value=='') { alert(alerttxt);return false } else {return true} } } function validateTicketCreateForm(thisform) { with (thisform) { if (validate_required(type,'Type must be filled\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65806,"url":"http:\/\/bangla.sitestree.com\/?p=65806","url_meta":{"origin":65792,"position":1},"title":"JavaScript Codes #JavaScript","author":"Author-Check- Article-or-Video","date":"July 15, 2021","format":false,"excerpt":"JavaScript is a very powerful scripting language for web-site development. Also, it is in much demand. var serviceInstancesArrAtLoad = Array(); var serviceInstancesArrAtSubmit = Array(); var tempArr=Array(); function validate_required(field,alerttxt) { with (field) { if (value==null||value=='') { alert(alerttxt);return false } else {return true} } } function validateTicketCreateForm(thisform) { with (thisform) { if\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":70137,"url":"http:\/\/bangla.sitestree.com\/?p=70137","url_meta":{"origin":65792,"position":2},"title":"Javascript Codes #13","author":"Author-Check- Article-or-Video","date":"August 27, 2021","format":false,"excerpt":"Javascript is a very powerfull scripting language for web-site development. Also, it is in much demand. In Europe Javascript experts earn 29-58 pound\/hour [ref: Internet] var serviceInstancesArrAtLoad = Array(); var serviceInstancesArrAtSubmit = Array(); var tempArr=Array(); function validate_required(field,alerttxt) { with (field) { if (value==null||value=='') { alert(alerttxt);return false } else {return true}\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10564,"url":"http:\/\/bangla.sitestree.com\/?p=10564","url_meta":{"origin":65792,"position":3},"title":"JavaScript Code","author":"","date":"August 29, 2015","format":false,"excerpt":"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var browser=navigator.appName; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var b_version=navigator.appVersion; <a href=\"http:\/\/www.justetc.net\" target=\"_blank\"> <img border=\"0\" alt=\"hello\" src=\"b_pink.gif\" id=\"b1\" width=\"26\" height=\"26\" onmouseover=\"mouseOver()\" onmouseout=\"mouseOut()\" \/> Place the following code under script tag\/in a javascript file function mouseOver() { \u00a0\u00a0 document.getElementById(\"b1\").src =\"b_blue.gif\"; } function mouseOut() { \u00a0\u00a0 document.getElementById(\"b1\").src =\"b_pink.gif\"; } <map name=\"planetmap\"> <area shape =\"rect\" coords =\"0,0,82,126\"\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10548,"url":"http:\/\/bangla.sitestree.com\/?p=10548","url_meta":{"origin":65792,"position":4},"title":"Javascript : Miscellaneous Code","author":"","date":"August 29, 2015","format":false,"excerpt":"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var browser=navigator.appName; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var b_version=navigator.appVersion; <a href=\"http:\/\/www.justetc.net\" target=\"_blank\"> <img border=\"0\" alt=\"hello\" src=\"b_pink.gif\" id=\"b1\" width=\"26\" height=\"26\" onmouseover=\"mouseOver()\" onmouseout=\"mouseOut()\" \/> Place the following code under script tag\/in a javascript file function mouseOver() { \u00a0\u00a0 document.getElementById(\"b1\").src =\"b_blue.gif\"; } function mouseOut() { \u00a0\u00a0 document.getElementById(\"b1\").src =\"b_pink.gif\"; } <map name=\"planetmap\"> <area shape =\"rect\" coords =\"0,0,82,126\"\u2026","rel":"","context":"In &quot;Ajax&quot;","block_context":{"text":"Ajax","link":"http:\/\/bangla.sitestree.com\/?cat=1418"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26499,"url":"http:\/\/bangla.sitestree.com\/?p=26499","url_meta":{"origin":65792,"position":5},"title":"JavaScript Code #Programming Code Examples #Javascript #JavaScript","author":"Author-Check- Article-or-Video","date":"April 26, 2021","format":false,"excerpt":"var browser=navigator.appName; var b_version=navigator.appVersion; <a href=\"http:\/\/www.justetc.net\" target=\"_blank\"> <img border=\"0\" alt=\"hello\" src=\"b_pink.gif\" id=\"b1\" width=\"26\" height=\"26\" onmouseover=\"mouseOver()\" onmouseout=\"mouseOut()\" \/> Place the following code under script tag\/in a javascript file function mouseOver() { document.getElementById(\"b1\").src =\"b_blue.gif\"; } function mouseOut() { document.getElementById(\"b1\").src =\"b_pink.gif\"; } <map name=\"planetmap\"> <area shape =\"rect\" coords =\"0,0,82,126\" onMouseOver=\"writeText('You are over the\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65792","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65792"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65792\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65792"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65792"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}