Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Asp HTML Validation

  • 12-07-2004 9:59am
    #1
    Registered Users, Registered Users 2 Posts: 446 ✭✭


    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


Comments

  • Registered Users, Registered Users 2 Posts: 4,276 ✭✭✭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 :)


  • Moderators, Politics Moderators Posts: 41,235 Mod ✭✭✭✭Seth Brundle


    try this...

    <edit> it's not HTML validation BTW! </edit>


  • Registered Users, Registered Users 2 Posts: 446 ✭✭kegan5


    I know HTML just came out there somewhere...thanks for zip file I'm going to take a look now :)


  • Moderators, Politics Moderators Posts: 41,235 Mod ✭✭✭✭Seth Brundle


    did that sort it?


  • Registered Users, Registered Users 2 Posts: 446 ✭✭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


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 446 ✭✭kegan5


    Ok The link to 1 of the pages that needs validating is:

    http://web.1asphost.com/kegan5/AddAuction.asp


  • Moderators, Politics Moderators Posts: 41,235 Mod ✭✭✭✭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


  • Registered Users, Registered Users 2 Posts: 446 ✭✭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:-/


  • Moderators, Politics Moderators Posts: 41,235 Mod ✭✭✭✭Seth Brundle


    oops - comment out the end if after the line
    if isDate(StartBid) and isDate(EndBid...


Advertisement