{"id":65804,"date":"2021-07-15T04:10:04","date_gmt":"2021-07-15T08:10:04","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/javascript-miscellaneous-validations-javascript\/"},"modified":"2021-07-15T04:10:04","modified_gmt":"2021-07-15T08:10:04","slug":"javascript-miscellaneous-validations-javascript","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=65804","title":{"rendered":"JavaScript &#8211; Miscellaneous Validations #JavaScript"},"content":{"rendered":"<p>function validateDomainName(strValue)<\/p>\n<pre>\t{\r\n\r\n\t\t\t\t\t\t\t\t\r\n\t\treturn \/www.[a-z0-9_-]+.[a-z]{2, 3}\/ig.test(strValue);\t\t\r\n\t}\r\n\r\n\tfunction validateDomainName(strValue) \r\n\t{\r\n\t\treturn \/www.[a-z0-9_-]+.[a-z]{2, 3}\/ig.test(strValue);\t\t\r\n\t}\r\n\r\n\r\n\t\/\/not 100% right, will fix later\r\n\tfunction checkDateFormat()\r\n\t{\r\n\t\tvar pattern = new RegExp(0|1[0-9]\/[0-3][0-9]\/[0-9][0-9]);\r\n\t\tif(document.getElementById('timestampStarted').value.match(pattern))\r\n\t\t{\r\n\t\t\tvar date_array = document.getElementById('timestampStarted').value.split('\/');\r\n\t\t\t\r\n\t\t\tvar month = date_array[0];\r\n\t\t\tvar day = date_array[1];\r\n\t\t\tvar year = date_array[2];\r\n\r\n\t\t\t\/\/ This instruction will create a date object\r\n\t\t\tsource_date = new Date(year,month,day);\r\n\t\r\n\t\t\tif(month != source_date.getMonth())\r\n\t\t\t{\r\n\t\t\t\talert('Month is not valid!');\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\r\n\t\t\tif(day != source_date.getDate())\r\n\t\t\t{\r\n\t\t\t\talert('Day is not valid!');\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(year != source_date.getYear())\r\n\t\t\t{\r\n\t\t\t\talert('Year is not valid!');\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\talert('Date format is not valid!');\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\r\n\t\treturn true;\r\n\t}\r\n\r\n\r\n\r\n\tfunction validateEmail( strValue) \r\n\t{\r\n\t\tvar objRegExp  = \/(^[a-z]([a-z_.]*)@([a-z_.]*)([.][a-z]{3})$)|(^\r\n                [a-z]([a-z_.]*)@([a-z_.]*)(.[a-z]{3})(.[a-z]{2})*$)\/i;\r\n\r\n  \t\t\/\/check for valid email\r\n  \t\treturn objRegExp.test(strValue);\r\n\t}\r\n\r\n\r\n\t\/\/AJAX Example\r\n\tfunction ajaxFunctionGeneral()\r\n\t{\r\n\t\tvar page_request = false\r\n\r\n\t\tif (window.XMLHttpRequest) \/\/ if Mozilla, IE7, Safari etc\r\n\t\t\tpage_request = new XMLHttpRequest()\r\n\t\telse if (window.ActiveXObject)\r\n\t\t{ \/\/ if IE\r\n\t\t\ttry \r\n\t\t\t{\r\n\t\t\t\tpage_request = new ActiveXObject(\"Msxml2.XMLHTTP\")\r\n\t\t\t} \r\n\t\t\tcatch (e)\r\n\t\t\t{\r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\t\tpage_request = new ActiveXObject(\"Microsoft.XMLHTTP\")\r\n\t\t\t\t}\r\n\t\t\t\tcatch (e)\r\n\t\t\t\t{\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\t\t\r\n\t\t\treturn false\r\n\t\treturn page_request;\r\n\t}\r\n\r\n\tfunction reboot(deviceId)\r\n\t{\r\n\t\tvar response=confirm('Are you sure to reboot');\r\n\t\t\r\n\t\tif(!response)\r\n\t\t\texit;\r\n\t\t\r\n\t\tpage_request = ajaxFunctionGeneral();\r\n\t\tif (!page_request) return false;\r\n\t\t\r\n\t\tpage_request.onreadystatechange=function()\r\n      {\r\n      \tif(page_request.readyState==4)\r\n        \t{\r\n        \t\tvar response=page_request.responseText;\r\n        \t\tvar displayArea = document.getElementById('showDiagnosticsResults');\r\n        \t\tdisplayArea.value = response;\r\n        \t}\r\n      }\r\n\t\tpage_request.open('GET', '\/Inventory\/Diagnostics\/reboot.php?deviceId='+deviceId, true)\r\n\t\tpage_request.send(null)\r\n\t}<\/pre>\n<p> From: http:\/\/sitestree.com\/?p=3477<br \/> Categories:JavaScript<br \/>Tags:<br \/> Post Data:2016-07-09 20:34:58<\/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>function validateDomainName(strValue) { return \/www.[a-z0-9_-]+.[a-z]{2, 3}\/ig.test(strValue); } function validateDomainName(strValue) { return \/www.[a-z0-9_-]+.[a-z]{2, 3}\/ig.test(strValue); } \/\/not 100% right, will fix later function checkDateFormat() { var pattern = new RegExp(0|1[0-9]\/[0-3][0-9]\/[0-9][0-9]); if(document.getElementById(&#8216;timestampStarted&#8217;).value.match(pattern)) { var date_array = document.getElementById(&#8216;timestampStarted&#8217;).value.split(&#8216;\/&#8217;); var month = date_array[0]; var day = date_array[1]; var year = date_array[2]; \/\/ This instruction will create a date object source_date &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=65804\">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-65804","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":70135,"url":"http:\/\/bangla.sitestree.com\/?p=70135","url_meta":{"origin":65804,"position":0},"title":"JavaScript &#8211; Miscellaneous Validations #13","author":"Author-Check- Article-or-Video","date":"August 27, 2021","format":false,"excerpt":"function validateDomainName(strValue) { return \/www.[a-z0-9_-]+.[a-z]{2, 3}\/ig.test(strValue); } function validateDomainName(strValue) { return \/www.[a-z0-9_-]+.[a-z]{2, 3}\/ig.test(strValue); } \/\/not 100% right, will fix later function checkDateFormat() { var pattern = new RegExp(0|1[0-9]\/[0-3][0-9]\/[0-9][0-9]); if(document.getElementById('timestampStarted').value.match(pattern)) { var date_array = document.getElementById('timestampStarted').value.split('\/'); var month = date_array[0]; var day = date_array[1]; var year = date_array[2]; \/\/ This instruction will\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":65804,"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":65804,"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":69880,"url":"http:\/\/bangla.sitestree.com\/?p=69880","url_meta":{"origin":65804,"position":3},"title":"Automating Digital Delivery with Paypal Payment Processing System #19","author":"Author-Check- Article-or-Video","date":"August 21, 2021","format":false,"excerpt":"In the past, I implemented an automatic notification and digital product delivery system with Paypal Payment Processing System. The concept is, when a person buys products from your web-sites, he gets his products automatically as email attachments after you have confirmed the transaction. The most important part is - collecting\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":67720,"url":"http:\/\/bangla.sitestree.com\/?p=67720","url_meta":{"origin":65804,"position":4},"title":"Automating Digital Delivery with Paypal Payment Processing System #Classic ASP","author":"Author-Check- Article-or-Video","date":"July 27, 2021","format":false,"excerpt":"Brought from: http:\/\/salearningschool.com\/displayArticle.php?table=Articles&articleID=1283&title=Automating%20Digital%20Delivery%20with%20Paypal%20Payment%20Processing%20System the time-period: 2007 - 2008 In the past, I implemented an automatic notification and digital product delivery system with Paypal Payment Processing System. The concept is, when a person buys products from your web-sites, he gets his products automatically as email attachments after you have confirmed 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":[]},{"id":10560,"url":"http:\/\/bangla.sitestree.com\/?p=10560","url_meta":{"origin":65804,"position":5},"title":"JavaScript Form Validation: Validate a Form Collecting Credit Card Information","author":"","date":"August 29, 2015","format":false,"excerpt":"\u00a0\u00a0 \u00a0function validateCollectPaymentInformationForm() \u00a0\u00a0 \u00a0{ \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0var method, name, number, expiry, errMsg \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0errMsg = \"\"; \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0method = document.getElementById('paymentMethod'); \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0name =\u00a0\u00a0 document.getElementById('txtCCName'); \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0number = document.getElementById('txtCCNumber'); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0if (method.value == \"\" || method.value ==\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":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65804","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=65804"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65804\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65804"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}