473,472 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Date vaidation after form submission

Hi there.

I have a form on which I have a date of expiry which is built from 3 select
fields to build the day, month and year, this all works OK and the data is
being built and added to the database no problem.

However, I want to validate this date to ensure it is in the future, the
following validation does not work, any ideas?

'get data from form
ExpiresDD = Request.Form("ExpiresDDin")
ExpiresMM = Request.Form("ExpiresMMin")
ExpiresYY = Request.Form("ExpiresYYin")

'build the date
Expires = ExpiresDD & "/" & ExpiresMM & "/" & ExpiresYY

'validate for in the future
if Expires <= Date then
errorSameDate = "True"
errorTrap = "True"
end if

I have also tried isDate(Expires) to check if todays date, as in, but no
luck again, obvs submitting todays date!

if isDate(Expires) then
errorSameDate = "True"
errorTrap = "True"
end if

Hope someone can help.

Cheers

Simon
Jul 21 '05 #1
4 1252
you need to look into the 'dateadd' function.

"Simon" wrote:
Hi there.

I have a form on which I have a date of expiry which is built from 3 select
fields to build the day, month and year, this all works OK and the data is
being built and added to the database no problem.

However, I want to validate this date to ensure it is in the future, the
following validation does not work, any ideas?

'get data from form
ExpiresDD = Request.Form("ExpiresDDin")
ExpiresMM = Request.Form("ExpiresMMin")
ExpiresYY = Request.Form("ExpiresYYin")

'build the date
Expires = ExpiresDD & "/" & ExpiresMM & "/" & ExpiresYY

'validate for in the future
if Expires <= Date then
errorSameDate = "True"
errorTrap = "True"
end if

I have also tried isDate(Expires) to check if todays date, as in, but no
luck again, obvs submitting todays date!

if isDate(Expires) then
errorSameDate = "True"
errorTrap = "True"
end if

Hope someone can help.

Cheers

Simon

Jul 21 '05 #2
'validate for in the future
if CDate(Expires) <= Date then
errorSameDate = "True"
errorTrap = "True"
end if

You might want to use a non-ambiguous date format as well before you get
bitten by the UK vs US date format differences

Expires = "20" & ExpiresYY & "-" & ExpiresMM & "-" & ExpiresDD
If not IsDate(Expires) Then
'put bad date error code here
End If

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Simon" <si*************@blueyonder.co.uk> wrote in message
news:hB*********************@fe2.news.blueyonder.c o.uk...
Hi there.

I have a form on which I have a date of expiry which is built from 3 select fields to build the day, month and year, this all works OK and the data is
being built and added to the database no problem.

However, I want to validate this date to ensure it is in the future, the
following validation does not work, any ideas?

'get data from form
ExpiresDD = Request.Form("ExpiresDDin")
ExpiresMM = Request.Form("ExpiresMMin")
ExpiresYY = Request.Form("ExpiresYYin")

'build the date
Expires = ExpiresDD & "/" & ExpiresMM & "/" & ExpiresYY

'validate for in the future
if Expires <= Date then
errorSameDate = "True"
errorTrap = "True"
end if

I have also tried isDate(Expires) to check if todays date, as in, but no
luck again, obvs submitting todays date!

if isDate(Expires) then
errorSameDate = "True"
errorTrap = "True"
end if

Hope someone can help.

Cheers

Simon

Jul 21 '05 #3
Don't you need to put "#"'s around the literals of a date ?

"Simon" <si*************@blueyonder.co.uk> wrote in message
news:hB*********************@fe2.news.blueyonder.c o.uk...
Hi there.

I have a form on which I have a date of expiry which is built from 3 select fields to build the day, month and year, this all works OK and the data is
being built and added to the database no problem.

However, I want to validate this date to ensure it is in the future, the
following validation does not work, any ideas?

'get data from form
ExpiresDD = Request.Form("ExpiresDDin")
ExpiresMM = Request.Form("ExpiresMMin")
ExpiresYY = Request.Form("ExpiresYYin")

'build the date
Expires = ExpiresDD & "/" & ExpiresMM & "/" & ExpiresYY

'validate for in the future
if Expires <= Date then
errorSameDate = "True"
errorTrap = "True"
end if

I have also tried isDate(Expires) to check if todays date, as in, but no
luck again, obvs submitting todays date!

if isDate(Expires) then
errorSameDate = "True"
errorTrap = "True"
end if

Hope someone can help.

Cheers

Simon

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.781 / Virus Database: 527 - Release Date: 10/22/2004
Jul 21 '05 #4
Thanks for that, again I managed a work around, but that was cleaner and
less code.

Luckily, in this case as well, the server and the users are in the UK, so no
US date issues.

Cheers

Simon

"Mark Schupp" <ms*****@ielearning.com> wrote in message
news:e7**************@TK2MSFTNGP14.phx.gbl...
'validate for in the future
if CDate(Expires) <= Date then
errorSameDate = "True"
errorTrap = "True"
end if

You might want to use a non-ambiguous date format as well before you get
bitten by the UK vs US date format differences

Expires = "20" & ExpiresYY & "-" & ExpiresMM & "-" & ExpiresDD
If not IsDate(Expires) Then
'put bad date error code here
End If

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Simon" <si*************@blueyonder.co.uk> wrote in message
news:hB*********************@fe2.news.blueyonder.c o.uk...
Hi there.

I have a form on which I have a date of expiry which is built from 3

select
fields to build the day, month and year, this all works OK and the data is being built and added to the database no problem.

However, I want to validate this date to ensure it is in the future, the
following validation does not work, any ideas?

'get data from form
ExpiresDD = Request.Form("ExpiresDDin")
ExpiresMM = Request.Form("ExpiresMMin")
ExpiresYY = Request.Form("ExpiresYYin")

'build the date
Expires = ExpiresDD & "/" & ExpiresMM & "/" & ExpiresYY

'validate for in the future
if Expires <= Date then
errorSameDate = "True"
errorTrap = "True"
end if

I have also tried isDate(Expires) to check if todays date, as in, but no
luck again, obvs submitting todays date!

if isDate(Expires) then
errorSameDate = "True"
errorTrap = "True"
end if

Hope someone can help.

Cheers

Simon


Jul 21 '05 #5

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

Similar topics

0
by: avinash | last post by:
We apologize if this is a duplicate email. EIGHTEENTH INTERNATIONAL CONFERENCE ON SYSTEMS ENGINEERING (ICSEng05) LAS VEGAS, USA, AUGUST 16-18, 2005 (http://www.icseng.info) This series of...
0
by: avinash | last post by:
We apologize if this is a duplicate email. International Conference on Computational Intelligence and Multimedia Applications, (ICCIMA) August 16-18, 2005 University of Nevada, Las Vegas, USA...
7
by: Colin Steadman | last post by:
I'm returning a date (5th Jan 2004) from Oracle using the following query: select TO_CHAR(invoice_date,'DD/MM/YYYY') from... This should return my date in the UK format, and it certainly...
2
by: Andy Goldstein | last post by:
I have a table where all the TRs have an onClick handler registered. One (and only one) of the rows has 2 text input boxes, where each textbox has an onChange handler registered. Both the onClick...
5
by: Astra | last post by:
Hi All I have a <SELECT> for the month (1 .. 12) and a <SELECT> for the year (2004 .... 2020), do you know of any js validation check I can use to check whether these values are older than...
23
by: Ash | last post by:
Hi everyone, This problem has been puzzling me for a fair time now, and has severely frustrated me!! Perhaps I'm just not getting the syntax right, but the problem is rather simple... Take a...
8
by: yawnmoth | last post by:
Say I have the following HTML: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> </head> <body> <form action="">
6
by: Oleg Konovalov | last post by:
Hi, I have a Java/JavaScript GUI application where I perform a lot of long DB operations , which takes 5-60 secs to perform. Sometimes user double-clicks the button or just gets impatient and...
17
by: Petyr David | last post by:
Just looking for the simplest. right now my perl script returns an error messge to the user if the date string is invalid. would like to do this before accessing the server. TX
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.