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!

Problem with forms 1

Status
Not open for further replies.

DaiDreamer

Programmer
May 8, 2001
31
US
Hi!

I'm having a problem with my form. How do you call a vbscript function when the submit button is pressed?

Here's my code:

<html>

<head>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;>
<meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 4.0&quot;>
<meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;>
<title>New Document</title>
<style fprolloverstyle>A:hover {color: #000080; text-decoration: underline}
</style>
<%@ Language=VBScript %>
<%'option explicit%>
</head>

<%
Function CheckFields()
dim count, errors, message, fieldcounter, Sectionconn, Sectionrs, Docconn,Docrs,strSQLQuery, strSQLQuery2
Count=0
Errors=0
Message=&quot;&quot;
FieldCounter=1
msgbox(&quot;tesitngin&quot;)
' Database Stuff to get Section Name
set Sectionconn = server.createobject(&quot;ADODB.Connection&quot;)
sectionconn.Open &quot;DSN=SuretyDNS&quot;
Session.timeout = 15
Set Session(&quot;MyDB_conn&quot;) = sectionconn

strSQLQuery = &quot;SELECT Code FROM Sections&quot;
Set Sectionrs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
sectionrs.Open strSQLQuery, sectionconn, 3, 3
Set sectionrs = Server.CreateObject(&quot;ADODB.Recordset&quot;)

set Docconn = server.createobject(&quot;ADODB.Connection&quot;)
Docconn.Open &quot;DSN=SuretyDNS&quot;
Session.timeout = 15
Set Session(&quot;MyDB_conn2&quot;) = Docconn

strSQLQuery2 = &quot;SELECT Code FROM DocumentTypes&quot;
Set docrs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
docrs.Open strSQLQuery2, docconn, 3, 3
Set docrs = Server.CreateObject(&quot;ADODB.Recordset&quot;)

For Fieldcounter = 1 to 4
Select Case Fieldcounter
Case 1
section1=request.form(&quot;SectionName1&quot;)
If SectionName1 <>&quot;&quot; then
Count=Count+1
BORDocNum1=request.form(&quot;BRDocNum1&quot;)
If BORDocNum1=&quot;&quot; then'from form
Errors=Errors+1
message=Message+&quot;Need to have Basis of Requirement Document Number in Line 1. &quot;
Else
do until sectionrs.eof
if SectionName1=sectionrs(&quot;Code&quot;) then 'valid
testing=1
if testing<>1 then
Errors=Errors+1
message=Message+&quot;Invalid Section Name in Line 1. &quot;
end if
end if
sectionrs.next
loop

DocType1=request.form(&quot;BRDocType1&quot;)
If doctype1 <>&quot;&quot; then'invalid
errors = errors +1
message=message + &quot;Invaild DocType in Line 1. &quot;
end if
if Errors >0 then
msgbox (message)
else
AddToDatabase()
end if
end if
end if
Case 2
section2=request.form(&quot;SectionName2&quot;)
If SectionName2 <>&quot;&quot; then
Count=Count+1
BORDocNum2=request.form(&quot;BRDocNum2&quot;)
If BORDocNum2=&quot;&quot; then 'from form
Errors=Errors+1
message=Message+&quot;Need to have Basis of Requirement Document Number in Line 2. &quot;
Else
do until sectionrs.eof
if SectionName2=sectionrs(&quot;Code&quot;) then'valid
testing=1
if testing<>1 then
Errors=Errors+1
message=Message+&quot;Invalid Section Name in Line 2. &quot;
end if
end if
sectionrs.next
loop

DocType2=request.form(&quot;BRDocType2&quot;)
If doctype1 <>&quot;&quot; then 'invalid
errors = errors +1
message=message + &quot;Invaild DocType in Line 2. &quot;
end if
if Errors >0 then
msgbox (message)
else
AddToDatabase()
end if
end if
end if
Case 3
section3=request.form(&quot;SectionName3&quot;)
If SectionName3 <>&quot;&quot; then
Count=Count+1
BORDocNum3=request.form(&quot;BRDocNum3&quot;)
If BORDocNum3=&quot;&quot; then'from form
Errors=Errors+1
message=Message+&quot;Need to have Basis of Requirement Document Number in Line 3. &quot;
Else
do until sectionrs.eof
if SectionName3=sectionrs(&quot;Code&quot;) then'valid
testing=1
if testing<>1 then
Errors=Errors+1
message=Message+&quot;Invalid Section Name in Line 3. &quot;
end if
end if
sectionrs.next
loop


DocType3=request.form(&quot;BRDocType3&quot;)
If doctype1 <>&quot;&quot; then'invalid
errors = errors +1
message=message + &quot;Invaild DocType in Line 3. &quot;
end if
if Errors >0 then
msgbox (message)
else
AddToDatabase()
end if
end if
end if
Case 4
section4=request.form(&quot;SectionName4&quot;)
If SectionName4 <>&quot;&quot; then
Count=Count+1
BORDocNum4=request.form(&quot;BRDocNum4&quot;)
If BORDocNum4=&quot;&quot; then 'from form
Errors=Errors+1
message=Message+&quot;Need to have Basis of Requirement Document Number in Line 4. &quot;
Else
do until sectionrs.eof
if SectionName4=sectionrs(&quot;Code&quot;) then'valid
testing=1
if testing<>1 then
Errors=Errors+1
message=Message+&quot;Invalid Section Name in Line 4. &quot;
end if
end if
sectionrs.next
loop

DocType4=request.form(&quot;BRDocType4&quot;)
If doctype1 <>&quot;&quot; then'invalid
errors = errors +1
message=message + &quot;Invaild DocType in Line 4. &quot;
end if
if Errors >0 then
msgbox (message)
else
AddToDatabase()
end if
end if
end if
end select
next
sectionconn.close
docconn.close
set sectionconn=nothing
set docconn = nothing
end function 'CheckFields()

Function AddtoDatabase()




end function 'AddtoDatabase()
%>
<body stylesrc=&quot;Index.html&quot; link=&quot;#0066FF&quot; vlink=&quot;#0066FF&quot; alink=&quot;#0066FF&quot;>
<p align=&quot;center&quot;><font face=&quot;Arial&quot; size=&quot;5&quot;>
Create New Document Record<br>
</font>
                    
<FORM ACTION=&quot;<%= Request.ServerVariables(&quot;SCRIPT_NAME&quot;) %>&quot; METHOD=&quot;post&quot; NAME=&quot;TheForm&quot;>

<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;3&quot; height=&quot;204&quot;>
<tr>
<td width=&quot;7%&quot; align=&quot;center&quot; bgcolor=&quot;#FFFFFF&quot; bordercolor=&quot;#FFFFFF&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#FFFFFF&quot; height=&quot;19&quot;> </td>
<td width=&quot;7%&quot; align=&quot;center&quot; bgcolor=&quot;#FFFFFF&quot; bordercolor=&quot;#FFFFFF&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#FFFFFF&quot; height=&quot;19&quot;> </td>
<td border=&quot;1&quot; bordercolor=&quot;#000000&quot; width=&quot;22%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; colspan=&quot;3&quot; height=&quot;19&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFF00&quot;>Basis
of Requirement</font></td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#FFFFFF&quot; bordercolor=&quot;#FFFFFF&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#FFFFFF&quot; height=&quot;19&quot;> </td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#FFFFFF&quot; bordercolor=&quot;#FFFFFF&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#FFFFFF&quot; height=&quot;19&quot;> </td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#FFFFFF&quot; bordercolor=&quot;#FFFFFF&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#FFFFFF&quot; height=&quot;19&quot;> </td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#FFFFFF&quot; bordercolor=&quot;#FFFFFF&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#FFFFFF&quot; height=&quot;19&quot;> </td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#FFFFFF&quot; bordercolor=&quot;#FFFFFF&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#FFFFFF&quot; height=&quot;19&quot;> </td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#FFFFFF&quot; bordercolor=&quot;#FFFFFF&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#FFFFFF&quot; height=&quot;19&quot;> </td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#FFFFFF&quot; bordercolor=&quot;#FFFFFF&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#FFFFFF&quot; height=&quot;19&quot;> </td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#FFFFFF&quot; bordercolor=&quot;#FFFFFF&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#FFFFFF&quot; height=&quot;19&quot;> </td>
</tr>
<tr>
<td width=&quot;7%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Section
Name</font></td>
<td width=&quot;7%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Date
of Requirement</font></td>
<td width=&quot;7%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Document
Type</font></td>
<td width=&quot;7%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Document
Number</font></td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Description
of Reason</font></td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Mine,
Program, or Parcel</font></td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Applicant/
Land Owner</font></td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Document
Number</font></td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Issued
by</font></td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Amount</font></td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Expiration
Date</font></td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Date
Issued</font></td>
<td width=&quot;8%&quot; align=&quot;center&quot; bgcolor=&quot;#000080&quot; height=&quot;48&quot;><font face=&quot;Arial&quot; size=&quot;2&quot; color=&quot;#FFFFFF&quot;>Returned
Date</font></td>
</tr>
<tr>
<td width=&quot;7%&quot; height=&quot;26&quot; align=&quot;center&quot;>
<input type=&quot;text&quot; name=&quot;SectionName1&quot; size=&quot;3&quot;>
</td>
<td width=&quot;7%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;RequireDate1&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
<td width=&quot;7%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;BRDocType1&quot; size=&quot;3&quot;>

</td>
<td width=&quot;7%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;BRDocNum1&quot; size=&quot;10&quot;>

</td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Reason1&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Mine1&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Applicant1&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;DocNum1&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Issued1&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Amount1&quot; size=&quot;15&quot; value=&quot;$&quot;></td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Expiration1&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;DateIssued1&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;ReturnDate1&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
</tr>
<tr>
<td width=&quot;7%&quot; height=&quot;26&quot; align=&quot;center&quot;>
<input type=&quot;text&quot; name=&quot;SectionName2&quot; size=&quot;3&quot;>
</td>
<td width=&quot;7%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;RequireDate2&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
<td width=&quot;7%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;BRDocType2&quot; size=&quot;3&quot;>

</td>
<td width=&quot;7%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;BRDocType2&quot; size=&quot;10&quot;>

</td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Reason2&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Mine2&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Applicant2&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;DocNum2&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Issued2&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Amount2&quot; size=&quot;15&quot; value=&quot;$&quot;></td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Expiration2&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;DateIssued2&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
<td width=&quot;8%&quot; height=&quot;26&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;ReturnDate2&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
</tr>
<tr>
<td width=&quot;7%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;SectionName3&quot; size=&quot;3&quot;>

</td>
<td width=&quot;7%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;RequireDate3&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
<td width=&quot;7%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;BRDocType3&quot; size=&quot;3&quot;></td>
<td width=&quot;7%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;BRDocType3&quot; size=&quot;10&quot;>

</td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Reason3&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Mine3&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Applicant3&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;DocNum3&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Issued3&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Amount3&quot; size=&quot;15&quot; value=&quot;$&quot;></td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Expiration3&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;DateIssued3&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;ReturnDate3&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
</tr>
<tr>
<td width=&quot;7%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;SectionName4&quot; size=&quot;3&quot;>

</td>
<td width=&quot;7%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;RequireDate4&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
<td width=&quot;7%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;BRDocType4&quot; size=&quot;3&quot;>

</td>
<td width=&quot;7%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;BRDocType4&quot; size=&quot;10&quot;>

</td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Reason4&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Mine4&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Applicant4&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;DocNum4&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Issued4&quot; size=&quot;20&quot;></td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Amount4&quot; size=&quot;15&quot; value=&quot;$&quot;></td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;Expiration4&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;DateIssued4&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
<td width=&quot;8%&quot; height=&quot;19&quot; align=&quot;center&quot;><input type=&quot;text&quot; name=&quot;ReturnDate4&quot; size=&quot;10&quot; value=&quot;mm/dd/yyyy&quot;>

</td>
</tr>
</table>

<p align=&quot;right&quot;><input type=&quot;submit&quot; Onclick= <%msgbox&quot;testing&quot;%> value=&quot;Submit&quot;><input type=&quot;reset&quot; value=&quot;Reset&quot;></p>
</form>
<p align=&quot;right&quot;><font face=&quot;Arial&quot;><a href=&quot;Index.html&quot;>Back</a></font>          <img border=&quot;0&quot; src=&quot;images/reeds.gif&quot; width=&quot;200&quot; height=&quot;198&quot; align=&quot;left&quot;></p>
</body>

</html>


Thanks!

DaiDreamer
 
The easyest way is to change your input type submit to input type button like so:
<input type=&quot;submit&quot;
should be:
&quot;><input type=&quot;button&quot;

And submit the form using your vb sub or function like so:
if isoktosubmit then
TheForm.submit();
else
msgbox &quot;bla bla ...&quot;
end if

The other way is to call a function in the onsubmit event of the form. Return true if the form is ok to be submitted and return false if not (I only know how to do this in Java) like so:
<SCRIPT LANGUAGE=javascript>
function myfunc() {
return true; // the form will be submitted
// return false; //the form wil not be submitted
}
</SCRIPT>
<form name=TheForm action=&quot;test.asp&quot; onsubmit=&quot;return myfunc()&quot;>
<input type=submit id=submit1 name=submit1&quot;>
</form>

 
Here is the vbScript sample
Code:
<HTML>
<script language=&quot;vbscript&quot;>
sub checkFields
 MsgBox &quot;Form submitted!&quot;
end sub
</script>
<BODY>
<input type=&quot;submit&quot; Onclick=&quot;checkFields()&quot; value=&quot;Submit&quot;>
</BODY>
</HTML>
Hope this helps you... ________
George, M
 
that's for the help.

but now I'm having a problem with msgboxes. It gives me this error:

Microsoft VBScript runtime error '800a0046'

Permission denied: 'msgbox'

/bureauofminere/frdocinvetory/new.asp, line 482


my code also don't like Option Explict either

Any Ideas???

DaiDreamer
 
The only spot I see off-hand where msgbox is being used in on the server side ASP code. msgbox cannot be used server side, it can only be used in the client side scripts.

Also, it looks like all your functions are server side, those also will not be able to be called from the buttons like it sounds like you want to do.

You should put all the stuff you want to do after the page has loaded in the script tags...

<SCRIPT Language=&quot;VBScript>
'Scripting code here....
</SCRIPT>

HTH

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top