HighDots Forums  

Weird re-format for dates

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Weird re-format for dates in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Zwi2000
 
Posts: n/a

Default Weird re-format for dates - 07-18-2004 , 12:28 AM






I know this might be too much, but you know how clients are ... they are
asking that while typing a date in a field.
Which is 10 digit long (mm/dd/yyyy). That once they enter the first two
digits the "/" is displayed automatically, then type the next two digits and
the other "/" is entered automatically, finally user enters the last 4
digits.

This would allow them to enter the numbers only, is this possible ?

Z



Reply With Quote
  #2  
Old   
Mick White
 
Posts: n/a

Default Re: Weird re-format for dates - 07-19-2004 , 11:02 AM






See:
http://www.mickweb.com/demo/dateInput.html

Yes it can be done:
onkeyup='if(this.value.length==2 || this.value.length==5)this.value+="/"'
But I wouldn't call it reliable, though.

I would check the "entry":

onchange='if(!(/^\d{2}\/\d{2}\/\d{4}$/.test(this.value))){
this.value=window.prompt("Please enter in the format mm/dd/yyyy","")}'

That's a very crude test though.
You could at least check to see if it's a valid date(between earliest
and latest acceptable dates), if you want to pursue this, I'll show you
how to do it.
Mick


Zwi2000 wrote:

Quote:
I know this might be too much, but you know how clients are ... they are
asking that while typing a date in a field.
Which is 10 digit long (mm/dd/yyyy). That once they enter the first two
digits the "/" is displayed automatically, then type the next two digits and
the other "/" is entered automatically, finally user enters the last 4
digits.

This would allow them to enter the numbers only, is this possible ?

Z



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.