Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1642

Re: Validating form inputs?

From Gene Wirchenko <genew@ocis.net>
Newsgroups comp.lang.java.help
Subject Re: Validating form inputs?
Date 2012-03-20 19:16 -0700
Organization A noiseless patient Spider
Message-ID <eodim79a4ms63j0nsbhk4bf7472hr96oqg@4ax.com> (permalink)
References <ed7f31e9-8a19-46c7-9a7c-ad8aabfb9599@x10g2000pbi.googlegroups.com> <cdthm7h8ouvn55aoeah597mjjse0j7mrkh@4ax.com>

Show all headers | View raw


On Tue, 20 Mar 2012 14:28:09 -0700, Roedy Green
<see_website@mindprod.com.invalid> wrote:

>On Tue, 20 Mar 2012 11:16:36 -0700 (PDT), Davej <galt_57@hotmail.com>
>wrote, quoted or indirectly quoted someone who said :
>
>>I have been thinking about the way I have been validating form inputs
>>in the servelet and wonder if I would be much better off using class
>>methods to verify these inputs?
>>
>>Consider that I am almost always gathering the inputs to instantiate
>>one or more objects, but I gather and validate -- and then
>>instantiate. Maybe I should instantiate an empty object and then use
>>class methods to validate the inputs?

     Classes can be very useful.  They can also be a waste of time. If
the only reason that you use classes is because you get to use
classes, that is not a good idea.

     I recall one assignment during my degree where this got
demonstrated rather well.  We were to write code comparing various CPU
time allocation algorithms.  I figured out how to code it and wrote
it.  I wrote procedural code.  There was no need for classes except
for the one class Java requires.  One of my classmates went the OOPS
route.  It did not work out, and he had to restart just before the
assignment was due.  He did not get through the whole assignment.  My
classmate was a sharp person.

     Just because you have a tool is no reason to use it.  No, I am
not arguing not using it.

>>Thanks
>It is rather rude to your user not to tell him he has made an error
>until several seconds after he has keyed an entire page.  This is
>almost as bad as 1960s batch processing. Even 1970s, 3270 terminals or
>keypunches could tell you on a field by field or keystroke by
>keystroke basis about many errors.

     I am having a bit of a battle in comp.lang.javascript over my
writing a form handler that give error messages on a
control-by-control basis.

     While I understand the opposition point of view, they do not give
me much credence.  They are much too doctrinaire for my taste.
Supposedly, I am writing something very vulnerable to browser
versions, etc.  We shall see.  Interestingly enough, I can probably
remove that part of my code and still have a traditional Web form.  (I
have not tried it yet, but the changes should be minor: cutting out a
few bits of code.)

>There are basically to ways to fix that.  Use an Applet on the client
>or use Ajax. Both have serious drawbacks.
>
>What is EXTREMELY rude is to erase some of his fields or even all of
>them if he makes an error.

     Must resist urge to top.  Must,  aRRGGGHHHH!!

     What is really, really extremely rude is to erase the so-called
erroneous value and not mention it in the error message.  The user
then does not know what happened.  Did he type the value in correctly,
or did he type it incorrectly?  (For example, transposition of
adjacent characters is an easy error to make, and is common.)

Sincerely,

Gene Wirchenko

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Validating form inputs? Davej <galt_57@hotmail.com> - 2012-03-20 11:16 -0700
  Re: Validating form inputs? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-03-20 12:08 -0700
    Re: Validating form inputs? Lew <lewbloch@gmail.com> - 2012-03-20 12:50 -0700
      Re: Validating form inputs? markspace <-@.> - 2012-03-21 09:24 -0700
      Re: Validating form inputs? Davej <galt_57@hotmail.com> - 2012-03-21 12:02 -0700
        Re: Validating form inputs? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-03-21 12:59 -0700
        Re: Validating form inputs? Lew <lewbloch@gmail.com> - 2012-03-21 13:37 -0700
    Re: Validating form inputs? Davej <galt_57@hotmail.com> - 2012-03-20 12:56 -0700
      Re: Validating form inputs? Lew <lewbloch@gmail.com> - 2012-03-20 13:58 -0700
      Re: Validating form inputs? markspace <-@.> - 2012-03-21 09:30 -0700
  Re: Validating form inputs? Roedy Green <see_website@mindprod.com.invalid> - 2012-03-20 14:28 -0700
    Re: Validating form inputs? Gene Wirchenko <genew@ocis.net> - 2012-03-20 19:16 -0700
      Re: Validating form inputs? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-21 17:41 -0300
        Re: Validating form inputs? Gene Wirchenko <genew@ocis.net> - 2012-03-21 14:46 -0700
          Re: Validating form inputs? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-03-21 19:54 -0300
        Re: Validating form inputs? Roedy Green <see_website@mindprod.com.invalid> - 2012-03-22 10:34 -0700
      Re: Validating form inputs? Lew <lewbloch@gmail.com> - 2012-03-21 14:56 -0700
        Re: Validating form inputs? Gene Wirchenko <genew@ocis.net> - 2012-03-21 19:09 -0700
          Re: Validating form inputs? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-03-22 08:36 -0700
            Re: Validating form inputs? Gene Wirchenko <genew@ocis.net> - 2012-03-22 09:40 -0700

csiph-web