Solved

date format in html

Posted on 2008-06-11
5
178 Views
Last Modified: 2010-04-09
Hi
when i am writing a form in html i have a date field and i want to put in input type="text" name="date" size="10"  maxlength='10'  and at the same i want to put for example   /  /   to strict the user to use 07/06/2008 not an empty field otherwise the user can put anything 07.06.08 or he can put 07-06-08 etc...
0
Comment
Question by:asaidi
  • 4
5 Comments
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21758849
why dont you have 3 fields with 2 characters in each

[DD] / [MM] / [YY]

alternatively you could draw a back ground image with the /  /  drawn on it and apply it to your field and limit it to 6 characters in length....

[     /      /     ]
0
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21758854
with the first method your form can then join the date together to the format you wish
DD/MM/YY
0
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21758865
!!! obviously with the first method I am implying that you add the / / in between the fields as HTML text
0
 

Author Comment

by:asaidi
ID: 21759737
means  i add value in my input type
input type="text" name="date" size="10"  maxlength='10'  value '  /  /   '
0
 
LVL 10

Accepted Solution

by:
bluefezteam earned 500 total points
ID: 21759791
no sorry you would write the code below, so that you have 3 small fields for each part of the date. when you submit the results to your form, the back end code can join them together
<input type="text" name="day" size="2"  maxlength='2'  value="dd" /> / <input type="text" name="month" size="2"  maxlength='2'  value="mm" /> / <input type="text" name="year" size="2"  maxlength='2'  value="yy" />

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question