Solved

date format in html

Posted on 2008-06-11
5
175 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
Comment Utility
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
Comment Utility
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
Comment Utility
!!! obviously with the first method I am implying that you add the / / in between the fields as HTML text
0
 

Author Comment

by:asaidi
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now