in reply to How to validate the form in CGI

isBlank() is not a predefined function in javascript. With firefox / mozilla you can open the javascript console with the url javascript: and you usually get decent error messages (at least, a lot better than in IE).

Also, it's not realy safe to rely on javascript alone to validate a form. You can read and test input with the CGI module's param() method.

update: and you should print the end_html() at the end of the html, not immediately after the start. :-)

Replies are listed 'Best First'.
Re^2: How to validate the form in CGI
by bradcathey (Prior) on Mar 08, 2005 at 12:00 UTC

    The mantra around the monastery is always "don't trust Javascript." That is true if a server-side check is omitted altogether, but Javascript can provide a very fast preliminary client-side check that doesn't require the long trip to the server. The JS validation protects the user with a fast check, while the server side protects the internals.

    I think both can work in tandem, with the understanding that the server-side validation will always be there.


    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot