Date validations using AJAX

S

Sunil

Hi,

I have a from with around 8 date fields.
All these are entered by the user and are to validated for holidays.
The holiday validation can only be done on server side.
I am planning to use AJAX for these date validations.
The validation must be done on onChange event of the date fields.

What is the best way to do this using AJAX?
Should i return XML data or JSON or just a simple text?



Thanks & Regards,
Sunil.
 
M

McKirahan

Sunil said:
Hi,

I have a from with around 8 date fields.
All these are entered by the user and are to validated for holidays.
The holiday validation can only be done on server side.
Why?

I am planning to use AJAX for these date validations.
The validation must be done on onChange event of the date fields.

What is the best way to do this using AJAX?
Should i return XML data or JSON or just a simple text?

Isn't True/False sufficient?

Why not just validate client-side against a list of holiday dates?
 
M

Michael Winter

I have a from with around 8 date fields.
All these are entered by the user and are to validated for holidays.
The holiday validation can only be done on server side.

Then submit the form to the server. AJAX isn't a substitute for these
sorts of things, and if this for the Web, then falling back to a simple
submission is the very least you need to implement, anyway.
I am planning to use AJAX for these date validations.

Why? How does that help the user (particularly users with scripting or
ActiveX disabled)?
The validation must be done on onChange event of the date fields.

Why? If later choices depend on the dates selected by the user, it's
entirely reasonable to break entry up over two pages.

[snip]

Mike
 
D

Dr John Stockton

JRS: In article <[email protected]>
, dated Sun, 2 Jul 2006 09:35:24 remote, seen in
news:comp.lang.javascript said:
All these are entered by the user and are to validated for holidays.
The holiday validation can only be done on server side.
I am planning to use AJAX for these date validations.


Of course, everything that really matters to the system owner must be
validated server-side.

However, if the application is such that most dates are in the near
future, it's feasible to send to the client a list of (or algorithm for)
near-future holidays, so that near-future holidays can be selected from
a list or validated client-side for faster response. Errors on non-
near-future dates will still be caught, on the server, where all dates
can be checked.

The server cannot check far-future holidays reliably, since national
holidays are subject to political whim.

On a company intranet, it could be quite interesting to discover that
the client-side validation has been by-passed; that means that someone
has been trying, probably in the company's time, to break the company's
system - which for most staff should be a disciplinary offence.

Alternatively, if someone breaks validation to enter a holiday date such
as (US) July 4th, let that be docked from his leave entitlement.
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top