Dropped Form Variables

K

Kevin Moore

Hello. I have an ASP page written in JSCRIPT that contains a regular
text field for a start date and an end date. The user may enter values
in this field or not. If the user doesn't enter any values, the
onclick event of the submit button populates these fields with a hard
coded default start and end date. I know this works because I can
actually see them populate before the page actually submits.

These two values are requested on the next page and everything works
like a champ for me. The problem is that my client ocassionally gets
"undefined" for these two values. Since they're used in a SQL
statement on the page, the script bombs. I can't for the life of me
figure out how these two values are being dropped! There's no interim
redirect page and nothing that I know of that would cause them not to
exist. The only possible theory I have is that the client is using a
proxy server (I don't know which) and I've had session variable
trouble with them in the past. But since this is a basically
straightforward HTML form variable problem, I don't have a clue. Any
help would be appreciated.

Kevin
 
D

Dave Anderson

Kevin said:
Hello. I have an ASP page written in JSCRIPT that contains a regular
text field for a start date and an end date. The user may enter values
in this field or not. If the user doesn't enter any values, the
onclick event of the submit button populates these fields with a hard
coded default start and end date. I know this works because I can
actually see them populate before the page actually submits.

These two values are requested on the next page and everything works
like a champ for me. The problem is that my client ocassionally gets
"undefined" for these two values...

Rather than depending on client scripting for your data integrity, why not
simply use conditional assignment on the server. After all, JScript makes it
easy:

var StartDate = Request.Form("StartDate").Item || "2004-01-01"

No client scripting required with this approach. Of course, I'd still do
some validation on any value I was intending to hand off to the DB...



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top