Web custum control

K

Karl Jensen

Hello gurus,
I would like to build a text box like date field in the following format
:dd-mm-yy. My thougts are that this should be possible with a web custum
control or by inheriting from a text box and override the render method to
get the desired effect.
Can anyone tell me if i'am on the right way or not. And if not , were should
i look instead.


Thanks in advance
 
J

JaD

Are you trying to validate input? You could probably just use Regular
Expressions...
 
K

Karl Jensen

Not quiet , i want to display " -- -- " in a textbox like control with
tab navigation beetwenn fields the box.
A user should then be able to fill in the fields like this:
"12--03--04" .
Make sens?
 
P

Peter Blum

It is very tricky to build the necessary javascript that maintains fixed
text (the dashes) within a textbox and moves the insertion point along.
Simply put, HTML wasn't designed to do that. To my knowledge, IE's DHTML
library comes closest to giving you the tools that allow modifing the
inserting point and replacing characters in text.

I recommend letting users enter text in your format and reformatting as they
exit the field. That's what I did in my commercial DateTextBox property,
"Peter's Date Package" (http://www.peterblum.com/datecontrols/home.aspx). In
my case, I developed the ability for the user to omit separators and have
the code re-insert them during reformat. For example, if they type "0312",
the software reformats to 03-12-2004 (determining the year from other
rules.) Peter's Date Package fully supports localization of date formats.
You specify your desired ShortDatePattern and DateSeparator.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top