|
Dan Boger wrote:
> well, not sure how you can do it with java, but you shouldn't rely on
> java for form validation anyhow - it's unreliable, and easily overcome.
> If you had to, you could add another text field, in which case enter
> won't submit the form, and you'd have to use the submit button.
I agree that JavaScript really isn't the best way to validate this. As
long
as you're doing CGI, why not do a POST to the same script, evaluate,
the answers, and complain if they're not any good?
With regards to the multiple fields, I think he's only running into
problems
if someone submits only a string of spaces. The string length check
should
eliminate people hitting <ENTER> without typing...
Anyhow, a way to do this (I think; I've tried to avoid JavaScript) is
to split on spaces, then compare the length of the resulting array with
the
initial length. Or you could traverse through the string character by
character and set a flag if a non-space is found...
Let me know if you need more details...
Chris
--
Remove the nospam machine name in my email address to send a personal reply.
|
|
Message is in Reply To:
| | Re: CGI question
|
| (...) well, not sure how you can do it with java, but you shouldn't rely on java for form validation anyhow - it's unreliable, and easily overcome. If you had to, you could add another text field, in which case enter won't submit the form, and you'd (...) (25 years ago, 6-Apr-00, to lugnet.off-topic.geek)
|
14 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|