Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,096
    Thanks
    15
    Thanked 1 Time in 1 Post

    Thumbs down validate DDMMYYYY

    Code:
    {
    	if( !/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/.test(obj.value) ) {
    		alert( "Invalid date supplied - must be format DD/MM/YYYY" );
    		obj.focus();
    		return;
    	}
    how do i change this to validate DDMMYYYY? (no slashes?)

  • #2
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Code:
    	if( !/^(\d{1,2})(\d{1,2})(\d{4})$/.test(obj.value) ) {
    		alert( "Invalid date supplied - must be format DD/MM/YYYY" );
    		obj.focus();
    		return;
    	}
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper


  •  

    Posting Permissions

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