Solved

date format in html

Posted on 2008-06-11
5
177 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Javascript to allow login/password authorization 4 44
Bootstrap on PLNKR 3 28
HTML5 Get data in table rows 5 27
Downside of adding characters set in ASP pages 6 17
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

776 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