{"id":1648,"date":"2010-02-10T03:45:58","date_gmt":"2010-02-10T09:45:58","guid":{"rendered":"http:\/\/www.mrc-productivity.com\/legacy\/?page_id=1648"},"modified":"2011-12-22T16:38:30","modified_gmt":"2011-12-22T22:38:30","slug":"validating-via-javascript-in-reports-source-code","status":"publish","type":"page","link":"https:\/\/www.mrc-productivity.com\/legacy\/form-validation-techniques\/validating-via-javascript-in-reports-source-code","title":{"rendered":"Validating via Javascript in Reports Source Code"},"content":{"rendered":"<p><!-- Begin Content --><\/p>\n<h1>Validating via Javascript in Reports Source Code<\/h1>\n<p>&nbsp;<\/p>\n<p><code><br \/>\n&lt;script type=\"text\/javascript\"&gt;<br \/>\nfunction validate_form ( )<br \/>\n\/\/Check two dates, DATEORD & DATEEXP in Maintenance application<br \/>\n{<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;valid = true;<\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;if (document.FORM_R00230.R001.value == 0 && document.FORM_R00230.R002.value == 0)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;{<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert ( \"You have not entered any dates.\" );<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;valid = false;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;}else if (document.FORM_R00230.R001.value == 0)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;{<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert ( \"You must enter a starting date.\" );<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;valid = false;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;}else if (document.FORM_R00230.R002.value == 0)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;{<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert ( \"You must enter an ending date.\" );<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;valid = false;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>\nelse if ( document.FORM_R00230.R001.value &gt; document.FORM_R00230.R002.value)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;{<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert ( \"Start Date is greater than End Date.\" );<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;valid = false;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return valid;<br \/>\n}<br \/>\n&lt;\/script&gt;<br \/>\n<\/code><\/p>\n<p><!-- End Content --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Validating via Javascript in Reports Source Code &nbsp; &lt;script type=&quot;text\/javascript&quot;&gt; function validate_form ( ) \/\/Check two dates, DATEORD &#038; DATEEXP in Maintenance application { &nbsp;&nbsp;&nbsp;&nbsp;valid = true; &nbsp;&nbsp;&nbsp;&nbsp;if (document.FORM_R00230.R001.value == 0 &#038;&#038; document.FORM_R00230.R002.value == 0) &nbsp;&nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert ( &quot;You have not entered any dates.&quot; ); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;valid = false; &nbsp;&nbsp;&nbsp;&nbsp;}else if (document.FORM_R00230.R001.value == 0) &nbsp;&nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1580,"menu_order":9,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1648","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/pages\/1648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/comments?post=1648"}],"version-history":[{"count":1,"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/pages\/1648\/revisions"}],"predecessor-version":[{"id":3435,"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/pages\/1648\/revisions\/3435"}],"up":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/pages\/1580"}],"wp:attachment":[{"href":"https:\/\/www.mrc-productivity.com\/legacy\/wp-json\/wp\/v2\/media?parent=1648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}