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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation Problem

Status
Not open for further replies.

slr22

MIS
Jun 26, 2002
80
US
I'm having some problem with my validation. The page that I'm doing the validation on is a page where I add a new line to the table in the database. I enter in a date field so I want to make sure that they are entering in a valid date. I use the following code:

Sub thisPage_onenter()

if (thisPage.firstEntered) then
Recordset1.addRecord()
end if
end Sub

Sub btnSubmit_onclick()

dim errmsg

OktoProcess=false

if txtDate.value <> &quot;&quot; and IsDate(txtDate.value) = false then
errmsg = &quot;Quote Due Date is a date field. Please enter the date in the format mm/dd/yyyy&quot;
else if txtProjDate.value <> &quot;&quot; and IsDate (txtProjDate.value) = false then
errmsg = &quot;Project Start Date is a date field. Please enter the date in the format mm/dd/yyyy&quot;
else
OktoProcess = true
end if
end if

if (OktoProcess=false) then
Response.Write &quot;<font size=4 color=red>&quot; & errmsg & &quot;</font>&quot;
else
Recordset1.updateRecord
Response.Redirect (&quot;MainMenu.asp&quot;)
end if
End Sub

I have this exact same code in another web application and it works just fine. However, with this one it seems to forget about the adding a new line and just updates the first line in the table. If I enter in a correct date and it skips having the output an error message, it works fine. Does anyone know why this might be doing this? Any help would be appreciated.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top