Connecting Tech Pros Worldwide Forums | Help | Site Map

How to implement mm/dd/yyyy format for textbox?

dyw55a
Guest
 
Posts: n/a
#1: Jul 23 '05

How to implement mm/dd/yyyy format for textbox?

I have text box with format mm/dd/yyyy. Now I want the cursor i
generated whenever user highlight this textbox and whatever user inpu
replace one of char in "mm/dd/yyyy" one at a time.

I will be appreciated if anyone could give me some idea to implemen
this through JavaScript.

thanks,
Am

--
dyw55
-----------------------------------------------------------------------
dyw55a's Profile: http://www.highdots.com/forums/member.php?userid=14
View this thread: http://www.highdots.com/forums/showthread.php?t=142895


McKirahan
Guest
 
Posts: n/a
#2: Jul 23 '05

re: How to implement mm/dd/yyyy format for textbox?


"dyw55a" <dyw55a.1q31fz@no-mx.forums.yourdomain.com.au> wrote in message
news:dyw55a.1q31fz@no-mx.forums.yourdomain.com.au...[color=blue]
>
> How to implement mm/dd/yyyy format for textbox?
>
> I have text box with format mm/dd/yyyy. Now I want the cursor is
> generated whenever user highlight this textbox and whatever user input
> replace one of char in "mm/dd/yyyy" one at a time.
>
> I will be appreciated if anyone could give me some idea to implement
> this through JavaScript.
>
> thanks,
> Amy
>
>
> --
> dyw55a[/color]

AFAIK, what you want (if I understand it) can't be done.

I think you want each succcessive position to be highlighted for
replacement.

If not, please clarify your requirements.

Here's is some code I started with:

<html>
<head>
<title>mmddyyyy.htm</title>
<script type="text/javascript">
var what = "mm/dd/yyyy";
function mdy(that) {
if (what != that.value) {
alert(that.value);
}
what = that.value;
}
</script>
</head>
<body>
<form action="" method="get">
<input type="text" size="10" maxlength="10"
name="mmddyyyy" value="mm/dd/yyyy" onkeyup="mdy(this)">
</form>
</body>
</html>


As an alternative, popup calendars are often used to select dates.


dyw55a
Guest
 
Posts: n/a
#3: Jul 23 '05

re: How to implement mm/dd/yyyy format for textbox?



Thank you for your reply.

Actually please check this web server control's demo:
http://www.assistedsolutions.com/com...InputMask.aspx

I want to implement something like that. I did everything bu
encountered some problem on updating the textbox. Only the way thi
control used to update the text one by one like the link could preven
my current issues.

thanks again,
Am

--
dyw55
-----------------------------------------------------------------------
dyw55a's Profile: http://www.highdots.com/forums/member.php?userid=14
View this thread: http://www.highdots.com/forums/showthread.php?t=142895

McKirahan
Guest
 
Posts: n/a
#4: Jul 23 '05

re: How to implement mm/dd/yyyy format for textbox?


"dyw55a" <dyw55a.1q5cs1@no-mx.forums.yourdomain.com.au> wrote in message
news:dyw55a.1q5cs1@no-mx.forums.yourdomain.com.au...[color=blue]
>
> Thank you for your reply.
>
> Actually please check this web server control's demo:
> http://www.assistedsolutions.com/com...InputMask.aspx
>
> I want to implement something like that. I did everything but
> encountered some problem on updating the textbox. Only the way this
> control used to update the text one by one like the link could prevent
> my current issues.
>
> thanks again,
> Amy
>
> --
> dyw55a[/color]

Try contacting them:
info@assistedsolutions.com


michael elias
Guest
 
Posts: n/a
#5: Jul 23 '05

re: How to implement mm/dd/yyyy format for textbox?


Well it is possible but it involves some scripting. My approach is to
create a div element that contains several absolute positioned
textboxes and spans. In HTML it looks like this;

<div style="position:relative;
width:200px;height:24px;background-color:white; border:solid blue 1px">
<input type="text"
style="position:absolute;left:2px;top:2px;height:2 0px;width:28px;border:solid
black 0px" maxLength="2"/>
<span
style="position:absolute;left:24px;top:2px;width:3 px;height:20px"[color=blue]
>/</span>[/color]
<input type="text"
style="position:absolute;left:30px;top:2px;height: 20px;width:28px;border:solid
black 0px" maxLength="2"/>
</div>

This will give you the desired effect of a masked input. You can use a
pattern as an input parameter and parse it with regular expressions to
create your masked input. Use the onkeypress event on the textboxes to
validate the typed characters.

dyw55a
Guest
 
Posts: n/a
#6: Jul 23 '05

re: How to implement mm/dd/yyyy format for textbox?



Thank you for your reply. This looks like a great idea. But how d
you think if it is possible not using the DIV tag? If you build a .ne
web server control, you might not be able to use <DIV>, right? Any mor
thought on this

--
dyw55
-----------------------------------------------------------------------
dyw55a's Profile: http://www.highdots.com/forums/member.php?userid=14
View this thread: http://www.highdots.com/forums/showthread.php?t=142895

McKirahan
Guest
 
Posts: n/a
#7: Jul 23 '05

re: How to implement mm/dd/yyyy format for textbox?


"dyw55a" <dyw55a.1q8abz@no-mx.forums.yourdomain.com.au> wrote in message
news:dyw55a.1q8abz@no-mx.forums.yourdomain.com.au...[color=blue]
>
> Thank you for your reply. This looks like a great idea. But how do
> you think if it is possible not using the DIV tag? If you build a .net
> web server control, you might not be able to use <DIV>, right? Any more
> thought on this?
>
>
> --
> dyw55a[/color]

Try reposting your question in a .NET newsgroup.


Closed Thread


Similar JavaScript / Ajax / DHTML bytes