|
-
Apr 20th, 2005, 06:18 AM
#1
Thread Starter
Fanatic Member
Date and Time Validation
Is there a way to mask text boxes so that they will only accept dates or times?
If not, how can I use a validation webcontrol to ensure that a date or a time was entered into an associated text box?
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 20th, 2005, 07:17 AM
#2
Member
Re: Date and Time Validation
Hi simon
include the folg code in the head tag
<script language="javascript" src="datetimepicker.js" type="text/javascript">
</script>
include the folg code in the form tag near the texbox
<A href="javascript:NewCal('txtDate','ddmmmyyyy')">
where txtDate holds the value for the date...
best wishes
venkat
Strength is Life, Weakness is Death
- Swami Vivekananda
-
Apr 20th, 2005, 07:20 AM
#3
Member
Re: Date and Time Validation
kindly check the attachment
venkat
Strength is Life, Weakness is Death
- Swami Vivekananda
-
Apr 20th, 2005, 09:39 AM
#4
Thread Starter
Fanatic Member
Re: Date and Time Validation
Hi,
Thanks for your solution.
However, I seem to be having a problem placing the following code:
Code:
<A href="javascript:NewCal('txtDate','ddmmmyyyy')">
I place it beneath my text box and every label afterwards becomes a link that pops up the date picker...
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 20th, 2005, 10:00 AM
#5
Re: Date and Time Validation
Place an </a> after the control you want to make a picker.
-
Apr 21st, 2005, 02:20 AM
#6
Thread Starter
Fanatic Member
Re: Date and Time Validation
Thanks Mendhak.
It seems it only makes labels popup the datepicker. Is that right? Can I make a button do it?
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 21st, 2005, 04:39 AM
#7
Re: Date and Time Validation
Yes.
In the button's tag, use the onClick="" attribute to call your javascript function that will popup your window for you.
-
Apr 21st, 2005, 04:50 AM
#8
Thread Starter
Fanatic Member
Re: Date and Time Validation
Oh right. Cheers!
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 21st, 2005, 06:49 AM
#9
Thread Starter
Fanatic Member
Re: Date and Time Validation
This is great for inputting dates...
But how do I actually validate that a text box holds a valid date or a valid time (in seperate boxes)?
I know about the IsDate function...but I need to validate dates and times seperately...
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 22nd, 2005, 05:41 AM
#10
Thread Starter
Fanatic Member
Re: Date and Time Validation
Hmm...actually, I'm having problems with this date picker. It returns a date in a format that cannot be parsed by the Date.Parse() function...?
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Apr 22nd, 2005, 06:26 AM
#11
Re: Date and Time Validation
Show your code and show examples of values that are being returned.
-
Apr 22nd, 2005, 06:57 AM
#12
Thread Starter
Fanatic Member
Re: Date and Time Validation
My button that calls the function:
Code:
<INPUT onclick="javascript:NewCal('txtJobDate','ddmmmyyyy')" type="button" value="...">
It returns today's date in this format: "22-Apr-2005".
My code that retrieves and parses the date from the text box:
VB Code:
Date.Parse(txtJobDate.Text)
My exception details are as follows:
"System.FormatException: String was not recognized as a valid DateTime."
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|