Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

validate form before submit

Status
Not open for further replies.

DrAsh

Technical User
May 3, 2001
46
US
I am using Frontpage 98. I have designed a form that gets submitted to an email address. I want ot put restrictions on the submit key such that it will not submit unless the name form has the person name filled in it. In others, when submit is pressed, it should respond &quot;Cannot submit, you havenot entered in your name. Please enter your name and then press submit.&quot; Below is my page. How cna I do this. or if someone could jsut write hte code in, I'd appreciate it. I'm a beginer in HTML and Javascript.<html>

<head><a name=&quot;top&quot;>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<title>admin TEST</title>
<script>

// (C) 2000 // // Free for all users, but leave in this header

function printWindow(){
bV = parseInt(navigator.appVersion)
if (bV >= 4) window.print()
}


</script>
</head>

<body bgcolor=&quot;#97BCE6&quot;>
<script language=&quot;JAVASCRIPT&quot;>
function grading(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10){
var right = 0;

if (a1 == true){
right = (right + 1);
}
if (a2 == true){
right = (right + 1);
}
if (a3 == true){
right = (right + 1);
}
if (a4 == true){
right = (right + 1);
}
if (a5 == true){
right = (right + 1);
}
if (a6 == true){
right = (right + 1);
}
if (a7 == true){
right = (right + 1);
}
if (a8 == true){
right = (right + 1);
}
if (a9 == true){
right = (right + 1);
}
if (a10 == true){
right = (right + 1);
}

if (right >= 9){
alert(&quot;You Passed. Now you must press Submit to Sumit your Results to HHCR and then scroll below to print your certificate&quot;);
name_on_certificate.value = document.forms[0].test_taker.value;
}
if (right < 9){
alert(&quot;You Failed and You must retake this test. Hit 'OK' and 'Refresh'. Don't forget to re-enter your name&quot;);
}
}
</script>


<table border=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td width=&quot;20%&quot;>&nbsp; <img src=&quot;hhcrlogonoinc1.gif&quot; width=&quot;135&quot; height=&quot;64&quot;
alt=&quot;Home HealthCare Resources&quot;></td>
<td width=&quot;61%&quot;><p align=&quot;center&quot;><strong><big><big><big>CORPORATE COMPLIANCE PROGRAM TEST
FOR ADMINISTRATIVE PERSONNEL</big></big></big></strong></td>
<td width=&quot;24%&quot;><img src=&quot;mcclogo.gif&quot; width=&quot;114&quot; height=&quot;63&quot;
alt=&quot;Maternal Child Consortium&quot; align=&quot;left&quot;></td>
</tr>
</table>

<table border=&quot;0&quot; width=&quot;269&quot; height=&quot;770&quot;>
<tr>
<td width=&quot;600&quot; height=&quot;96&quot;></a><p align=&quot;left&quot;><br>
<em>Directions:<br>
<br>
Answer True (T) or False (F) to the following statements. Use either the mouse or
space-bar to mark your answer. Afterwards, you must grade the exam.&nbsp; If you Passed,
submit your exam for validation and print your certificate for your records.<br>
<br>
</em></td>
</tr>
<tr>
<td width=&quot;1530&quot; height=&quot;641&quot;><form method=&quot;POST&quot; name=&quot;Administration Test Results&quot;
target=&quot;_blank&quot; action=&quot;--WEBBOT-SELF--&quot;>
<!--webbot bot=&quot;SaveResults&quot; startspan S-Email-Format=&quot;TEXT/PRE&quot;
S-Email-Address=&quot;training@hhcr.com&quot; B-Email-Label-Fields=&quot;TRUE&quot;
B-Email-Subject-From-Field=&quot;FALSE&quot; S-Email-Subject=&quot;Administration TEST RESULTS&quot;
S-Builtin-Fields=&quot;Date Time REMOTE_USER&quot; U-Confirmation-Url=&quot;results were submitted.htm&quot; --><!--webbot
bot=&quot;SaveResults&quot; endspan --><input type=&quot;hidden&quot; name=&quot;Test Taken&quot; value=&quot;Administration&quot;><div
align=&quot;right&quot;><table border=&quot;0&quot; width=&quot;311&quot; height=&quot;500&quot; bgcolor=&quot;#97BCE6&quot;>
<tr>
<td width=&quot;614&quot; height=&quot;32&quot; colspan=&quot;3&quot;><font face=&quot;Arial&quot;><em><strong>ENTER YOUR NAME
HERE:</strong>&nbsp; </em><!--webbot bot=&quot;Validation&quot; B-Value-Required=&quot;TRUE&quot;
I-Minimum-Length=&quot;2&quot; --><input type=&quot;text&quot; name=&quot;test_taker&quot; size=&quot;36&quot;></font><br>
</td>
</tr>
<tr>
<td width=&quot;46&quot; height=&quot;32&quot;><div align=&quot;center&quot;><center><p><u><strong><font face=&quot;Arial&quot;>TRUE</font></strong></u></td>
<td width=&quot;46&quot; height=&quot;32&quot; align=&quot;center&quot;><div align=&quot;center&quot;><center><p><u><font
face=&quot;Arial&quot;><strong>FALSE</strong></font></u></td>
<td width=&quot;200&quot; height=&quot;32&quot; align=&quot;center&quot;></td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;32&quot;><div align=&quot;center&quot;><center><p><input type=&quot;radio&quot; name=&quot;Q1&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;32&quot; align=&quot;center&quot;><div align=&quot;center&quot;><center><p><input
type=&quot;radio&quot; name=&quot;Q1&quot; value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;32&quot; align=&quot;center&quot; nowrap><div align=&quot;left&quot;><p>1.&nbsp; Violations
or suspected violation of federal and state regulations must be reported
immediately.&nbsp;&nbsp; <br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;78&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q2&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;78&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q2&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;78&quot; nowrap><div align=&quot;left&quot;><p>2.&nbsp;&nbsp; Inspector General
Act of 1978, Healthcare Fraud Prevention of 1995, Health&nbsp; Insurance Portability &amp;
Accountability Act of 1996 and Balanced Budget Act&nbsp; of 1997 are legislation passed by
Congress to address fraud and abuse.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;46&quot; align=&quot;center&quot; nowrap>&nbsp;<input type=&quot;radio&quot; name=&quot;Q3&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;44&quot; height=&quot;46&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q3&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;46&quot; nowrap><div align=&quot;left&quot;><p>3.&nbsp;&nbsp; Fraud is an
unintentional deception or misrepresentation by a provider.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;71&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q4&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;71&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q4&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;71&quot; nowrap><div align=&quot;left&quot;><p>4.&nbsp;&nbsp; Abuses are
practices or services of providers that are inconsistent with sound medical practice
(Billing, Documentation errors).<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;65&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q5&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;65&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q5&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;65&quot; nowrap><div align=&quot;left&quot;><p>5.&nbsp;&nbsp; Fraud/Abuse
prevention and compliance with all federal and state regulations is the responsibility of
the Compliance Officer only.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;27&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q6&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;27&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q6&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;27&quot; nowrap><div align=&quot;left&quot;><p>6.&nbsp;&nbsp; An effective
compliance program will detect and prevent fraud and abuse.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q7&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q7&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;40&quot; nowrap><div align=&quot;left&quot;><p>7.&nbsp;&nbsp; HHCR/MCC Compliance
Officer is Tom Galvin.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q8&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q8&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;40&quot; nowrap><div align=&quot;left&quot;><p>8.&nbsp;&nbsp; Corporate Counsel
and Compliance Officer are responsible for approving Corporate Standards at HHCR/MCC.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q9&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q9&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;40&quot; align=&quot;left&quot; nowrap><div align=&quot;left&quot;><p>9. &nbsp;&nbsp; The
Administrator is responsible for reviewing data prior to cost reporting calculation.</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;21&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q10&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;21&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q10&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;21&quot; align=&quot;left&quot; nowrap>10.&nbsp; Medical records must be retained
for a period of no less than six (6) years.</td>
</tr>
</table>
</div><div align=&quot;center&quot;><center><p><input type=&quot;button&quot;
value=&quot;Click this Button to Grade Your Exam&quot; name=&quot;grader2&quot;
onclick=&quot;grading(Q1[0].checked, Q2[0].checked, Q3[1].checked, Q4[0].checked, Q5[1].checked, Q6[0].checked, Q7[0].checked, Q8[1].checked, Q9[0].checked, Q10[0].checked)&quot;>
</p>
</center></div><div align=&quot;center&quot;><center><p><input type=&quot;reset&quot; value=&quot;Refresh&quot;
name=&quot;reset_button&quot;> <input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;B1&quot;></p>
</center></div><div align=&quot;center&quot;><center><p><a href=&quot;javascript:printWindow()&quot;>Click to
Print for your records.</a> </p>
</center></div>
</form>
</td>
</tr>
</table>

<p align=&quot;center&quot;><font face=&quot;Arial Black&quot; color=&quot;#FF0000&quot;>YOUR CERTIFICATE (KEEP FOR YOUR
RECORDS)</font></p>
<div align=&quot;center&quot;><center>

<table border=&quot;1&quot; width=&quot;61%&quot; height=&quot;387&quot;>
<tr>
<td width=&quot;100%&quot; background=&quot;CERTIFICATE_FRAME.jpg&quot; height=&quot;381&quot; valign=&quot;middle&quot;><p
align=&quot;center&quot;><br>
<font face=&quot;Arial Black&quot; size=&quot;4&quot;>Congratulations</font><br>
<br>
<input type=&quot;text&quot; name=&quot;name_on_certificate&quot; size=&quot;20&quot;></p>
<p align=&quot;center&quot;><font face=&quot;Arial Black&quot; size=&quot;3&quot; color=&quot;#000000&quot;>You have completed the
HHCR/MCC<br>
Compliance Training Program</font></p>
<p align=&quot;center&quot;><script Language=&quot;JavaScript&quot;>
function tickClock()
{
// this tells the browser to call the &quot;tickClock()&quot; function every 1 second
setTimeout(&quot;tickClock()&quot;, 1000);

thisTime = new Date()
hours = thisTime.getHours()
minutes = thisTime.getMinutes()
seconds = thisTime.getSeconds()

// convert the digit to string
// make sure there're at least 2 digits
if (hours>=12)
{
hours-=12
}

hourString=&quot;0&quot;+hours+&quot;&quot;
minuteString=&quot;0&quot;+minutes+&quot;&quot;
secondString=&quot;0&quot;+seconds+&quot;&quot;

// format the hour
hour1=parseInt(hourString.charAt(hourString.length-1))
hour2=parseInt(hourString.charAt(hourString.length-2))

// format the minute
minute1=parseInt(minuteString.charAt(minuteString.length-1))
minute2=parseInt(minuteString.charAt(minuteString.length-2))

// format the seconds
second1=parseInt(secondString.charAt(secondString.length-1))
second2=parseInt(secondString.charAt(secondString.length-2))


}
</script> <!-- --><!-- --> <script LANGUAGE=&quot;JavaScript&quot;>
<!--
var date=new Date();
document.write(&quot;<font size=-2 face='Arial, Helvetica, sans-serif' color=003399> &quot;+ date);
//-->
</script>
</td>
</tr>
</table>
</center></div>

<p align=&quot;center&quot;><br>
</p>
</body>
</html>
 
Put this in the heading:
Code:
function check() {
if (document.forms[0].test_taker.value == &quot;&quot;) {
alert(&quot;Cannot submit, you have not entered in your name.  Please enter your name and then press submit.&quot;)
return false
}
else {
return true
}
And add this to the <form> tag:
Code:
onsubmit=&quot;return check()&quot;

I haven't tested this but it should work.
 
I missed a &quot;}&quot;. The else statement should look like:
else {
return true
}
}
 
Iadded your script but i get an error:

undeterminated string constant. It's refering to the alert( etc... line

 
I figured out my error but the script you gave doesnt' seem to work. I included it in my page but no luck. It still submitted the form without a name.

By theway, function check() is a script so when I put it in the heading, I added <script> and </script>. I also added the script coomands around onsubmit=&quot;return check()&quot;

No luck. Any ideas?
 
You shouldn't have to add new <script> tags, just put it in the ones that are already there.
If you could post the whole code I'll probably be able to tell you what's wrong...
 
Ok, here's the code for the entire page with your script added.


<html>

<head><a name=&quot;top&quot;>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<title>admin TEST</title>
<script>

function printWindow(){
bV = parseInt(navigator.appVersion)
if (bV >= 4) window.print()
}


</script>
<script>
function check () {
if (document.forms[0].test_taker.value == &quot;&quot;) {
alert(&quot;Cannot Submit. You have not entered your name. Please enter your name and then press submit.&quot;)
return false
}
else {
return true }
}

</script>
</head>

<body bgcolor=&quot;#97BCE6&quot;>
<script language=&quot;JAVASCRIPT&quot;>
function grading(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10){
var right = 0;

if (a1 == true){
right = (right + 1);
}
if (a2 == true){
right = (right + 1);
}
if (a3 == true){
right = (right + 1);
}
if (a4 == true){
right = (right + 1);
}
if (a5 == true){
right = (right + 1);
}
if (a6 == true){
right = (right + 1);
}
if (a7 == true){
right = (right + 1);
}
if (a8 == true){
right = (right + 1);
}
if (a9 == true){
right = (right + 1);
}
if (a10 == true){
right = (right + 1);
}

if (right >= 9){
alert(&quot;You Passed. Now you must press Submit to Sumit your Results to HHCR and then scroll below to print your certificate&quot;);
name_on_certificate.value = document.forms[0].test_taker.value;
}
if (right < 9){
alert(&quot;You Failed and You must retake this test. Hit 'OK' and 'Refresh'. Don't forget to re-enter your name&quot;);
}
}
</script>


<table border=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td width=&quot;20%&quot;>&nbsp; <img src=&quot;hhcrlogonoinc1.gif&quot; width=&quot;135&quot; height=&quot;64&quot;
alt=&quot;Home HealthCare Resources&quot;></td>
<td width=&quot;61%&quot;><p align=&quot;center&quot;><strong><big><big><big>CORPORATE COMPLIANCE PROGRAM TEST
FOR ADMINISTRATIVE PERSONNEL</big></big></big></strong></td>
<td width=&quot;24%&quot;><img src=&quot;mcclogo.gif&quot; width=&quot;114&quot; height=&quot;63&quot;
alt=&quot;Maternal Child Consortium&quot; align=&quot;left&quot;></td>
</tr>
</table>

<table border=&quot;0&quot; width=&quot;269&quot; height=&quot;770&quot;>
<tr>
<td width=&quot;600&quot; height=&quot;96&quot;></a><p align=&quot;left&quot;><br>
<em>Directions:<br>
<br>
Answer True (T) or False (F) to the following statements. Use either the mouse or
space-bar to mark your answer. Afterwards, you must grade the exam.&nbsp; If you Passed,
submit your exam for validation and print your certificate for your records.<br>
<br>
</em></td>
</tr>
<tr>
<td width=&quot;1530&quot; height=&quot;641&quot;><form method=&quot;POST&quot; name=&quot;Administration Test Results&quot;
target=&quot;_blank&quot; action=&quot;--WEBBOT-SELF--&quot;>
<!--webbot bot=&quot;SaveResults&quot; startspan S-Email-Format=&quot;TEXT/PRE&quot;
S-Email-Address=&quot;training@hhcr.com&quot; B-Email-Label-Fields=&quot;TRUE&quot;
B-Email-Subject-From-Field=&quot;FALSE&quot; S-Email-Subject=&quot;Administration TEST RESULTS&quot;
S-Builtin-Fields=&quot;Date Time REMOTE_USER&quot; U-Confirmation-Url=&quot;results were submitted.htm&quot; --><input TYPE=&quot;hidden&quot; NAME=&quot;VTI-GROUP&quot; VALUE=&quot;0&quot;><!--webbot
bot=&quot;SaveResults&quot; endspan --><input type=&quot;hidden&quot; name=&quot;Test Taken&quot; value=&quot;Administration&quot;><div
align=&quot;right&quot;><table border=&quot;0&quot; width=&quot;311&quot; height=&quot;500&quot; bgcolor=&quot;#97BCE6&quot;>
<tr>
<td width=&quot;614&quot; height=&quot;32&quot; colspan=&quot;3&quot;><font face=&quot;Arial&quot;><em><strong>ENTER YOUR NAME
HERE:</strong>&nbsp; </em><input type=&quot;text&quot; name=&quot;test_taker&quot; size=&quot;36&quot;></font><br>
</td>
</tr>
<tr>
<td width=&quot;46&quot; height=&quot;32&quot;><div align=&quot;center&quot;><center><p><u><strong><font face=&quot;Arial&quot;>TRUE</font></strong></u></td>
<td width=&quot;46&quot; height=&quot;32&quot; align=&quot;center&quot;><div align=&quot;center&quot;><center><p><u><font
face=&quot;Arial&quot;><strong>FALSE</strong></font></u></td>
<td width=&quot;200&quot; height=&quot;32&quot; align=&quot;center&quot;></td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;32&quot;><div align=&quot;center&quot;><center><p><input type=&quot;radio&quot; name=&quot;Q1&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;32&quot; align=&quot;center&quot;><div align=&quot;center&quot;><center><p><input
type=&quot;radio&quot; name=&quot;Q1&quot; value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;32&quot; align=&quot;center&quot; nowrap><div align=&quot;left&quot;><p>1.&nbsp; Violations
or suspected violation of federal and state regulations must be reported
immediately.&nbsp;&nbsp; <br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;78&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q2&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;78&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q2&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;78&quot; nowrap><div align=&quot;left&quot;><p>2.&nbsp;&nbsp; Inspector General
Act of 1978, Healthcare Fraud Prevention of 1995, Health&nbsp; Insurance Portability &amp;
Accountability Act of 1996 and Balanced Budget Act&nbsp; of 1997 are legislation passed by
Congress to address fraud and abuse.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;46&quot; align=&quot;center&quot; nowrap>&nbsp;<input type=&quot;radio&quot; name=&quot;Q3&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;44&quot; height=&quot;46&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q3&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;46&quot; nowrap><div align=&quot;left&quot;><p>3.&nbsp;&nbsp; Fraud is an
unintentional deception or misrepresentation by a provider.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;71&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q4&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;71&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q4&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;71&quot; nowrap><div align=&quot;left&quot;><p>4.&nbsp;&nbsp; Abuses are
practices or services of providers that are inconsistent with sound medical practice
(Billing, Documentation errors).<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;65&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q5&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;65&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q5&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;65&quot; nowrap><div align=&quot;left&quot;><p>5.&nbsp;&nbsp; Fraud/Abuse
prevention and compliance with all federal and state regulations is the responsibility of
the Compliance Officer only.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;27&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q6&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;27&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q6&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;27&quot; nowrap><div align=&quot;left&quot;><p>6.&nbsp;&nbsp; An effective
compliance program will detect and prevent fraud and abuse.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q7&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q7&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;40&quot; nowrap><div align=&quot;left&quot;><p>7.&nbsp;&nbsp; HHCR/MCC Compliance
Officer is Tom Galvin.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q8&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q8&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;40&quot; nowrap><div align=&quot;left&quot;><p>8.&nbsp;&nbsp; Corporate Counsel
and Compliance Officer are responsible for approving Corporate Standards at HHCR/MCC.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q9&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q9&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;40&quot; align=&quot;left&quot; nowrap><div align=&quot;left&quot;><p>9. &nbsp;&nbsp; The
Administrator is responsible for reviewing data prior to cost reporting calculation.</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;21&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q10&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;21&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q10&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;21&quot; align=&quot;left&quot; nowrap>10.&nbsp; Medical records must be retained
for a period of no less than six (6) years.</td>
</tr>
</table>
<script>
onsubmit=&quot;return check ()&quot;
</script>
</div><div align=&quot;center&quot;><center><p><input type=&quot;button&quot;
value=&quot;Click this Button to Grade Your Exam&quot; name=&quot;grader2&quot;
onclick=&quot;grading(Q1[0].checked, Q2[0].checked, Q3[1].checked, Q4[0].checked, Q5[1].checked, Q6[0].checked, Q7[0].checked, Q8[1].checked, Q9[0].checked, Q10[0].checked)&quot;>
</p>
</center></div><div align=&quot;center&quot;><div align=&quot;center&quot;><center><p><input type=&quot;reset&quot;
value=&quot;Refresh&quot; name=&quot;reset_button&quot;> <input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;B1&quot;></p>
</center></div><div align=&quot;center&quot;></div></div><div align=&quot;center&quot;><center><p><a
href=&quot;javascript:printWindow()&quot;>Click to Print for your records.</a> </p>
</center></div>
</form>
</td>
</tr>
</table>

<p align=&quot;center&quot;><font face=&quot;Arial Black&quot; color=&quot;#FF0000&quot;>YOUR CERTIFICATE (KEEP FOR YOUR
RECORDS)</font></p>
<div align=&quot;center&quot;><center>

<table border=&quot;1&quot; width=&quot;61%&quot; height=&quot;387&quot;>
<tr>
<td width=&quot;100%&quot; background=&quot;CERTIFICATE_FRAME.jpg&quot; height=&quot;381&quot; valign=&quot;middle&quot;><p
align=&quot;center&quot;><br>
<font face=&quot;Arial Black&quot; size=&quot;4&quot;>Congratulations</font><br>
<br>
<input type=&quot;text&quot; name=&quot;name_on_certificate&quot; size=&quot;20&quot;></p>
<p align=&quot;center&quot;><font face=&quot;Arial Black&quot; size=&quot;3&quot; color=&quot;#000000&quot;>You have completed the
HHCR/MCC<br>
Compliance Training Program</font></p>
<p align=&quot;center&quot;><script Language=&quot;JavaScript&quot;>
function tickClock()
{
// this tells the browser to call the &quot;tickClock()&quot; function every 1 second
setTimeout(&quot;tickClock()&quot;, 1000);

thisTime = new Date()
hours = thisTime.getHours()
minutes = thisTime.getMinutes()
seconds = thisTime.getSeconds()

// convert the digit to string
// make sure there're at least 2 digits
if (hours>=12)
{
hours-=12
}

hourString=&quot;0&quot;+hours+&quot;&quot;
minuteString=&quot;0&quot;+minutes+&quot;&quot;
secondString=&quot;0&quot;+seconds+&quot;&quot;

// format the hour
hour1=parseInt(hourString.charAt(hourString.length-1))
hour2=parseInt(hourString.charAt(hourString.length-2))

// format the minute
minute1=parseInt(minuteString.charAt(minuteString.length-1))
minute2=parseInt(minuteString.charAt(minuteString.length-2))

// format the seconds
second1=parseInt(secondString.charAt(secondString.length-1))
second2=parseInt(secondString.charAt(secondString.length-2))


}
</script> <!-- --><!-- --> <script LANGUAGE=&quot;JavaScript&quot;>
<!--
var date=new Date();
document.write(&quot;<font size=-2 face='Arial, Helvetica, sans-serif' color=003399> &quot;+ date);
//-->
</script>
</td>
</tr>
</table>
</center></div>

<p align=&quot;center&quot;><br>
</p>
</body>
</html>
 
Copied the code, added the suggested function -- worked fine for me:

<html>

<head><a name=&quot;top&quot;>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<title>admin TEST</title>
<script>

function printWindow(){
bV = parseInt(navigator.appVersion)
if (bV >= 4) window.print()
}

function check() {
if (document.forms[0].test_taker.value == &quot;&quot;) {
alert(&quot;Cannot submit, you have not entered in your name. Please enter your name and then press submit.&quot;)
return false
}
else {
return true
}
}
</script>
<script>
function check () {
if (document.forms[0].test_taker.value == &quot;&quot;) {
alert(&quot;Cannot Submit. You have not entered your name. Please enter your name and then press submit.&quot;)
return false
}
else {
return true }
}

</script>
</head>

<body bgcolor=&quot;#97BCE6&quot;>
<script language=&quot;JAVASCRIPT&quot;>
function grading(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10){
var right = 0;

if (a1 == true){
right = (right + 1);
}
if (a2 == true){
right = (right + 1);
}
if (a3 == true){
right = (right + 1);
}
if (a4 == true){
right = (right + 1);
}
if (a5 == true){
right = (right + 1);
}
if (a6 == true){
right = (right + 1);
}
if (a7 == true){
right = (right + 1);
}
if (a8 == true){
right = (right + 1);
}
if (a9 == true){
right = (right + 1);
}
if (a10 == true){
right = (right + 1);
}

if (right >= 9){
alert(&quot;You Passed. Now you must press Submit to Sumit your Results to HHCR and then scroll below to print your certificate&quot;);
name_on_certificate.value = document.forms[0].test_taker.value;
}
if (right < 9){
alert(&quot;You Failed and You must retake this test. Hit 'OK' and 'Refresh'. Don't forget to re-enter your name&quot;);
}
}
</script>


<table border=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td width=&quot;20%&quot;> <img src=&quot;hhcrlogonoinc1.gif&quot; width=&quot;135&quot; height=&quot;64&quot;
alt=&quot;Home HealthCare Resources&quot;></td>
<td width=&quot;61%&quot;><p align=&quot;center&quot;><strong><big><big><big>CORPORATE COMPLIANCE PROGRAM TEST
FOR ADMINISTRATIVE PERSONNEL</big></big></big></strong></td>
<td width=&quot;24%&quot;><img src=&quot;mcclogo.gif&quot; width=&quot;114&quot; height=&quot;63&quot;
alt=&quot;Maternal Child Consortium&quot; align=&quot;left&quot;></td>
</tr>
</table>

<table border=&quot;0&quot; width=&quot;269&quot; height=&quot;770&quot;>
<tr>
<td width=&quot;600&quot; height=&quot;96&quot;></a><p align=&quot;left&quot;><br>
<em>Directions:<br>
<br>
Answer True (T) or False (F) to the following statements. Use either the mouse or
space-bar to mark your answer. Afterwards, you must grade the exam. If you Passed,
submit your exam for validation and print your certificate for your records.<br>
<br>
</em></td>
</tr>
<tr>
<td width=&quot;1530&quot; height=&quot;641&quot;><form method=&quot;POST&quot; name=&quot;Administration Test Results&quot;
target=&quot;_blank&quot; action=&quot;--WEBBOT-SELF--&quot; onSubmit=&quot;return check();&quot;>
<!--webbot bot=&quot;SaveResults&quot; startspan S-Email-Format=&quot;TEXT/PRE&quot;
S-Email-Address=&quot;training@hhcr.com&quot; B-Email-Label-Fields=&quot;TRUE&quot;
B-Email-Subject-From-Field=&quot;FALSE&quot; S-Email-Subject=&quot;Administration TEST RESULTS&quot;
S-Builtin-Fields=&quot;Date Time REMOTE_USER&quot; U-Confirmation-Url=&quot;results were submitted.htm&quot; --><input TYPE=&quot;hidden&quot; NAME=&quot;VTI-GROUP&quot; VALUE=&quot;0&quot;><!--webbot
bot=&quot;SaveResults&quot; endspan --><input type=&quot;hidden&quot; name=&quot;Test Taken&quot; value=&quot;Administration&quot;><div
align=&quot;right&quot;><table border=&quot;0&quot; width=&quot;311&quot; height=&quot;500&quot; bgcolor=&quot;#97BCE6&quot;>
<tr>
<td width=&quot;614&quot; height=&quot;32&quot; colspan=&quot;3&quot;><font face=&quot;Arial&quot;><em><strong>ENTER YOUR NAME
HERE:</strong> </em><input type=&quot;text&quot; name=&quot;test_taker&quot; size=&quot;36&quot;></font><br>
</td>
</tr>
<tr>
<td width=&quot;46&quot; height=&quot;32&quot;><div align=&quot;center&quot;><center><p><u><strong><font face=&quot;Arial&quot;>TRUE</font></strong></u></td>
<td width=&quot;46&quot; height=&quot;32&quot; align=&quot;center&quot;><div align=&quot;center&quot;><center><p><u><font
face=&quot;Arial&quot;><strong>FALSE</strong></font></u></td>
<td width=&quot;200&quot; height=&quot;32&quot; align=&quot;center&quot;></td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;32&quot;><div align=&quot;center&quot;><center><p><input type=&quot;radio&quot; name=&quot;Q1&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;32&quot; align=&quot;center&quot;><div align=&quot;center&quot;><center><p><input
type=&quot;radio&quot; name=&quot;Q1&quot; value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;32&quot; align=&quot;center&quot; nowrap><div align=&quot;left&quot;><p>1. Violations
or suspected violation of federal and state regulations must be reported
immediately. <br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;78&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q2&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;78&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q2&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;78&quot; nowrap><div align=&quot;left&quot;><p>2. Inspector General
Act of 1978, Healthcare Fraud Prevention of 1995, Health Insurance Portability &
Accountability Act of 1996 and Balanced Budget Act of 1997 are legislation passed by
Congress to address fraud and abuse.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;46&quot; align=&quot;center&quot; nowrap> <input type=&quot;radio&quot; name=&quot;Q3&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;44&quot; height=&quot;46&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q3&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;46&quot; nowrap><div align=&quot;left&quot;><p>3. Fraud is an
unintentional deception or misrepresentation by a provider.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;71&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q4&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;71&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q4&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;71&quot; nowrap><div align=&quot;left&quot;><p>4. Abuses are
practices or services of providers that are inconsistent with sound medical practice
(Billing, Documentation errors).<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;65&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q5&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;65&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q5&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;65&quot; nowrap><div align=&quot;left&quot;><p>5. Fraud/Abuse
prevention and compliance with all federal and state regulations is the responsibility of
the Compliance Officer only.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;27&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q6&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;27&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q6&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;27&quot; nowrap><div align=&quot;left&quot;><p>6. An effective
compliance program will detect and prevent fraud and abuse.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q7&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q7&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;40&quot; nowrap><div align=&quot;left&quot;><p>7. HHCR/MCC Compliance
Officer is Tom Galvin.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q8&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q8&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;40&quot; nowrap><div align=&quot;left&quot;><p>8. Corporate Counsel
and Compliance Officer are responsible for approving Corporate Standards at HHCR/MCC.<br>
</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q9&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;40&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q9&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;40&quot; align=&quot;left&quot; nowrap><div align=&quot;left&quot;><p>9. The
Administrator is responsible for reviewing data prior to cost reporting calculation.</td>
</tr>
<tr align=&quot;center&quot;>
<td width=&quot;46&quot; height=&quot;21&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q10&quot;
value=&quot;CORRECT&quot;></td>
<td width=&quot;46&quot; height=&quot;21&quot; align=&quot;center&quot; nowrap><input type=&quot;radio&quot; name=&quot;Q10&quot;
value=&quot;INCORRECT&quot;></td>
<td width=&quot;550&quot; height=&quot;21&quot; align=&quot;left&quot; nowrap>10. Medical records must be retained
for a period of no less than six (6) years.</td>
</tr>
</table>
<script>
onsubmit=&quot;return check ()&quot;
</script>
</div><div align=&quot;center&quot;><center><p><input type=&quot;button&quot;
value=&quot;Click this Button to Grade Your Exam&quot; name=&quot;grader2&quot;
onclick=&quot;grading(Q1[0].checked, Q2[0].checked, Q3[1].checked, Q4[0].checked, Q5[1].checked, Q6[0].checked, Q7[0].checked, Q8[1].checked, Q9[0].checked, Q10[0].checked)&quot;>
</p>
</center></div><div align=&quot;center&quot;><div align=&quot;center&quot;><center><p><input type=&quot;reset&quot;
value=&quot;Refresh&quot; name=&quot;reset_button&quot;> <input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;B1&quot;></p>
</center></div><div align=&quot;center&quot;></div></div><div align=&quot;center&quot;><center><p><a
href=&quot;javascript:printWindow()&quot;>Click to Print for your records.</a> </p>
</center></div>
</form>
</td>
</tr>
</table>

<p align=&quot;center&quot;><font face=&quot;Arial Black&quot; color=&quot;#FF0000&quot;>YOUR CERTIFICATE (KEEP FOR YOUR
RECORDS)</font></p>
<div align=&quot;center&quot;><center>

<table border=&quot;1&quot; width=&quot;61%&quot; height=&quot;387&quot;>
<tr>
<td width=&quot;100%&quot; background=&quot;CERTIFICATE_FRAME.jpg&quot; height=&quot;381&quot; valign=&quot;middle&quot;><p
align=&quot;center&quot;><br>
<font face=&quot;Arial Black&quot; size=&quot;4&quot;>Congratulations</font><br>
<br>
<input type=&quot;text&quot; name=&quot;name_on_certificate&quot; size=&quot;20&quot;></p>
<p align=&quot;center&quot;><font face=&quot;Arial Black&quot; size=&quot;3&quot; color=&quot;#000000&quot;>You have completed the
HHCR/MCC<br>
Compliance Training Program</font></p>
<p align=&quot;center&quot;><script Language=&quot;JavaScript&quot;>
function tickClock()
{
// this tells the browser to call the &quot;tickClock()&quot; function every 1 second
setTimeout(&quot;tickClock()&quot;, 1000);

thisTime = new Date()
hours = thisTime.getHours()
minutes = thisTime.getMinutes()
seconds = thisTime.getSeconds()

// convert the digit to string
// make sure there're at least 2 digits
if (hours>=12)
{
hours-=12
}

hourString=&quot;0&quot;+hours+&quot;&quot;
minuteString=&quot;0&quot;+minutes+&quot;&quot;
secondString=&quot;0&quot;+seconds+&quot;&quot;

// format the hour
hour1=parseInt(hourString.charAt(hourString.length-1))
hour2=parseInt(hourString.charAt(hourString.length-2))

// format the minute
minute1=parseInt(minuteString.charAt(minuteString.length-1))
minute2=parseInt(minuteString.charAt(minuteString.length-2))

// format the seconds
second1=parseInt(secondString.charAt(secondString.length-1))
second2=parseInt(secondString.charAt(secondString.length-2))


}
</script> <!-- --><!-- --> <script LANGUAGE=&quot;JavaScript&quot;>
<!--
var date=new Date();
document.write(&quot;<font size=-2 face='Arial, Helvetica, sans-serif' color=003399> &quot;+ date);
//-->
</script>
</td>
</tr>
</table>
</center></div>

<p align=&quot;center&quot;><br>
</p>
</body>
</html>

:)
 
DrAsh-
It looks like you just forgot to add the code I mentioned above to the <form> tag. It should be like this:

<form method=&quot;POST&quot; [red]onsubmit=&quot;return check()&quot;[/red] name=&quot;Administration Test Results&quot;
target=&quot;_blank&quot; action=&quot;--WEBBOT-SELF--&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top