Verify Date..HELP!!!!!

Results 1 to 5 of 5

Thread: Verify Date..HELP!!!!!

  1. #1
    Mr.McPhee Guest

    Default Verify Date..HELP!!!!!

    I am wanting to validate that the values entered in a form are definitely dates.<BR><BR>I have 3 text boxes. Box1 = 28<BR> Box2 = Month. eg. MAR<BR> Box3 = Year eg. 00.<BR><BR>I am wanting to write some VBScript which will concatenate these strings and then check that it is a date BEFORE the form is submitted. However, I am very raw to the world of VBScript and would greatly appreciate any pointers/help offered.<BR><BR>Thanks in advance<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Verify Date..HELP!!!!!

    NewDateVar = Box1 & "/" & Box2 & "/" & Box 3<BR><BR>GetCurrentDate = FormatDateTime(NewDateVar, vbLongDate)<BR>

  3. #3
    J Guest

    Default RE: Verify Date..HELP!!!!!

    I am not aware of a way to VALIDATE a date using VBScript without submitting the page. You can use JavaScript to validate the date before submission using the onBlur event. Otherwise you will need to submit the page and use the IsDate() VB function. If you are going to use only Internet Explorer you can use its "browser side" VBScript capabilities triggered by the onBlur event, however this will NOT work in Netscape.

  4. #4
    Mr.McPhee Guest


    THis is my aborted attempt at it. Can anyone give me a pointer??<BR><BR><BR>&#060;script language=VBScript&#062;<BR>Private Sub Process()<BR> NewDateVar = day & " " & month & " " & year<BR> ExpiryDate = FormatDateTime (NewDateVar, vbLongDate)<BR> IF IsDate(ExpiryDate) THEN<BR> Form1.submit()<BR> ELSE<BR> MsgBox("This is not a valid date")<BR> END IF<BR>End Sub<BR>&#060;/script&#062;

  5. #5
    Join Date
    Dec 1969


    You have missed out the / character within the double quotes.<BR><BR>John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts