how to check completeness of a form

andrew cooke andrew at acooke.org
Mon May 5 09:25:52 EDT 2003


it depends where you want to do the processing, and how robust you want to
be.  in the project i'm responsible for at work, for example, we check the
browser type and verify data using javascript within the browser if the
version of javascript (the version of the web browser) is up-to-date
enough.  this is just so that the user has a nicer experience - they don't
have to wait for the data to be processed on the server to see an error
message saying that they've missed a required field.  but we also
duplicate all processing on the server because (1) not all browsers
support javascript, or have it enabled and (2) a malicious user can bypass
javascript on the browser to send bad data, but they can't avoid the
server-side processing.

in other words, javascript on the client is usually something to add
later, once your server is working.  it duplicates work you have to do on
the server, but makes the end user's life easier.

at least, that's the theory.  my project for today is to work out why our
server side error handling is broken... :o)

also, of course, if you're using python and are wondering about javascript
then it's one more thing to learn - probably better to focus on one thing
at a time.

(i'm assuming that you'd use javascript on the client's browser and python
cgi (or, in my case, java) on the server; you could use javascript on the
server side (write cgi scripts in javascript), but it's not normally done
that way).

andrew


Psybar Phreak said:

> sorry - yes - cgi related - written in python - unles you guys think it
> would be easier written in javascript?
>
>
> "Psybar Phreak" <psybar_phreak at yahoo.com> wrote in message
> news:3eb586f1$0$16175$afc38c87 at news.optusnet.com.au...
>> say i have three form elements on a web page (say fnameField, lnameField
> and
>> email) - how do i loop through each field checking if its complete and
> only
>> when it is, let the rest of the script process
>>
>> thanks
>>
>> daina
>>
>>
>>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>


-- 
http://www.acooke.org/andrew





More information about the Python-list mailing list