Date validation

Results 1 to 3 of 3

Thread: Date validation

  1. #1
    Join Date
    Dec 1969

    Default Date validation

    I am using JavaScript to validate my form. In one of the forms I have combination of Radio button and text box. Eg Report of transaction from somedate to some date. Only if the corresponding radio button is checked, I need to check if the dates entered in the text boxes are valid dates. please help me how to write that code.

  2. #2
    Join Date
    Dec 1969

    Default RE: Date validation

    when I do date validation/manipulation I always call a vbscript routine...<BR><BR>&#060;script language=javascript&#062;<BR>function valDate(DateIn)<BR>{<BR> ValidateDate(DateIn);<BR>}<BR>&#060;/script&#062;<BR>&#060;script language=vbscript&#062;<BR>sub ValidateDate(DateIn)<BR> if isDate(DateIn)<BR> &#039;do some stuff<BR> end if<BR>end sub<BR>&#060;/script&#062;<BR><BR>or some variation from that. I think client side vbscript only works for IE though.

  3. #3
    Join Date
    Dec 1969

    Default What about this.....?

    For one of my earlier posts Bill Willkinson suggested something like this...<BR><BR>function isDate(strDate){ //strDate is the date to be passed<BR> if( isNaN(Date.parse( strDate ))) alert("Not a valid date");<BR> else alert("This is a valid date");<BR>}<BR>This should work in both the browsers.<BR>Just checkout the earlier post here<BR><BR><BR>Haris.

Posting Permissions

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