Discussions
Categories
Groups
Advertisement
Child Item
Home
Topics
Technology & Internet
Software & Web Development
Development
Asp HTML Validation
kegan5
I've looked on google and w3schools for help on validating text boxes...but they either come up with a load of gobbledegook or dont do what I need.
I need to validate 3 text boxes...on seperate pages...
1. to check no numbers are in the text box (We'll call this one "No Num")
1. to check numbers are in the text box (We'll call this one "Num")
1. to check a date format has been entered in the text box (We'll call this one "Date")
Does anyone know a short piece of code to do these validations? or any sites online that actually explain how to do it?
Thanks
Kate
Find more posts tagged with
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of
Advertisement
Advertisement
Comments
damnyanks
Would you use Javascript or is Asp the only option?
If you use a ASP version you must wait for the form to be submitted to the server before anythings happens. If you use Javascript it wont submit the form it will show the errors first.
There are lots of form validation scripts out there in JS. Not too sure about ASP. I know Asp.Net has built in form validation controls but that outputs javascript
Seth Brundle
try this...
<edit> it's not HTML validation BTW! </edit>
kegan5
I know HTML just came out there somewhere...thanks for zip file I'm going to take a look now
Seth Brundle
did that sort it?
kegan5
em well the code works...but when I tried to fit it into my asp page it gave error messages... I'm just uploading the site to an asp host so I'll show u the errors I'm getting when Ive done that
kegan5
Ok The link to 1 of the pages that needs validating is:
http://web.1asphost.com/kegan5/AddAuction.asp
Seth Brundle
couple of things:-
You open a DB connection in the AddAuction.asp page but it is not necessary.
You insert the data into the table in the other file before you run the check
you are getting an error around the lines of your check:-
I changed them to
if isNumeric(Cost) = false then Response.Redirect("page1.asp")
'else
for i = 0 to 9
if inStr(no_num, i) > 0 then Response.Redirect("page1.asp")
next
Response.Redirect("Auction2.asp") 'unsure what this is for
'Else
if isDate(StartBid) and isDate(EndBid) then Response.Redirect("Auction2.asp")
End if
'End if
'End if
kegan5
it says : Microsoft VBScript compilation error '800a0400'
Expected statement
/kegan5/InsertItem2.asp, line 49
End if
^
I changed the part you said...and did an error check by entering letters into the cost text box and the above happened:-/
Seth Brundle
oops - comment out the end if after the line
if isDate(StartBid) and isDate(EndBid...