A Runtime Error has occured,

I 'm getting a problem with some vbscript and html code.

I've got a form, but i want to validate it before being sent to a asp script.

Getting a runtime error?

Any ideas, or examples?



Has anybody got examples of a html form validation, then sending it to a asp script?

jonnygrantAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
cable4096Connect With a Mentor Commented:
I have a Form named FrontPage_Form1
on it there is an Input Type named place_call which is the button type not a submit type. If the values for the StartDate and EndDate text boxes on the form are empty, the form refuses to submit. If there is not text entered into NoticeText, the form refuses to submit.

This is due to a flag variable I named i_error which defaults to 0 as per my code, and then is set to 1 if there is a problem. At the end of the sub, you will note that if i_error is 0, the submit method is processessed, if not, it does not get run.



Sub place_call_OnClick
Dim i_error
Dim s_msg

i_error = 0

if Len(Document.FrontPage_Form1.StartDate.Value) = 0 Then
      MsgBox "You Must Enter Start Date.",64,"Missing Information"
      i_error = 1
end if
if Len(Document.FrontPage_Form1.EndDate.Value) = 0 Then
      MsgBox "You Must Enter End Date.",64,"Missing Information"
      i_error = 1
end if
if Len(Document.FrontPage_Form1.NoticeText.Value) = 0 Then
      MsgBox "You Must Enter Notice Text.",64,"Missing Information"
      i_error = 1
end if

If i_error = 0 then
            Document.FrontPage_Form1.Submit
End if
end sub
0
 
caraf_gCommented:
There are so many run time errors. Each caused by something completely different.

We need information, information, information.
0
 
jonnygrantAuthor Commented:
Edited text of question.
0
 
jonnygrantAuthor Commented:
Edited text of question.
0
 
jonnygrantAuthor Commented:
Edited text of question.
0
All Courses

From novice to tech pro — start learning today.