473,395 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Format Question

I have a textbox named "mydate" and I want to add an "onblur" event to
it that will format the text in this format:

dd-MMM-yy

the data entry people use this format in the text box:

dd/mm/yy
d/mm/yy....

I'm having a heck of a time trying to get this to work. Any help would
be appreciated.

Nov 19 '05 #1
2 1049
> I have a textbox named "mydate" and I want to add an "onblur" event to
it that will format the text in this format:

dd-MMM-yy


Is that because the date has to be entered in the format? If so, then you
want to either:

a) format this on the server side prior to entering into the DB

or

b) use a validator control to make sure data is entered in that format to
begin with.

You could reformat it in the field, but that would require javascript, and
there's no guarantee that the end-user would have that enabled, so you'd
still have to check for the format on the server side anyway.

-Darrel
Nov 19 '05 #2
One of the challenges that you face with showing the abbreviated month name
is that the CompareValidator doesn't support it. CompareValidator handles
digits for months.

There are a few third party DateTextBoxes with popup calendars available
that may handle abbreviated month names. Mine, "Peter's Date Package"
(http://www.peterblum.com/datecontrols/home.aspx) definitely does. If you
choose to download a free trial version, here's how you will set it up.
1. Add the DateTextBox
2. Establish the format with the xDateTimeFormatInfo property described on
page 34 of the User's Guide. When you do this, you will set these values:
ShortDatePattern = "dd-MM-yy" (not MMM)
DateSeparator = "-"
3. Set the xAllowMonthNames property to "Show"
4. My stuff comes with validators to handle the unusual format. Add a
DateTextBoxValidator for that purpose.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"pmclinn" <pe***@mclinn.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have a textbox named "mydate" and I want to add an "onblur" event to
it that will format the text in this format:

dd-MMM-yy

the data entry people use this format in the text box:

dd/mm/yy
d/mm/yy....

I'm having a heck of a time trying to get this to work. Any help would
be appreciated.

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Dario Di Bella | last post by:
Hi all, we have the following urgent issue affecting our development team. Initially we had one particular workstation that failed executing queries on a DB2 database, raising an invalid date...
1
by: Tom | last post by:
In the Developers Handbook, Getz provides a way to create a survey report that displays either a line, Yes/No or multiple choice for each question. It's done by placing three controls (one for each...
7
by: Tommy Vercetti | last post by:
The first three of these statements work. The fourth doesn't. String::Format("{0}{0}{0}{0}", S""); String::Format("{0}{1}{0}{0}", S"", S""); String::Format("{0}{1}{2}{0}", S"", S"", S"");...
16
by: Al Reid | last post by:
First, I'm using vb2005. I have a string that is read from a barcode reader into a TextBox. The string is 6 characters long and represents a date (mmddyy). I want to display it to the user in a...
2
by: gjuro kladaric | last post by:
hi there, I am just learning about IFormattable, ICustomFormatter, IFormatProvider and the like... although being a bit tricky to understand, it becomes clear after some clicking and...
13
by: Roy | last post by:
Hi all, I'm creating a project that should always use this date format when displays the dates or create dates. The back end database is a SQL Server and I like to know what is the logical way...
5
by: veaux | last post by:
I'm thinking this is easy but can't get it. I have a table with following: Table1 Date 1/1/2007 Table2 Type 0107 (This is MMYY of above) So I'm having trouble using a query to turn the...
10
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a...
12
by: param | last post by:
Hi All, I want to use %x as directive to get the locale specific date representation. But, at the same time, i want to know the format of the output for interpreting it through program. Is there...
9
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.