Re: Perl output Javascript to validate user input
- From: "Matt Garrish" <matthew.garrish@xxxxxxxxxxxx>
- Date: Wed, 5 Apr 2006 07:18:32 -0400
"phal" <betterdie@xxxxxxxxx> wrote in message
news:1144228935.665924.159510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I want to do the following,
First method:
1- Generate Html from Perl script for user input form,
2- After user input, the javascript which embed with Perl script to
check validate in the client side
3- When the validate is okay, the user input will store in the
database.
Second method:
1- Generate Html from Perl script for user input form
2- User input will be validate in the server side by Perl Regular
Expression
3- If it is valid, the user input will save into the database.
Third Method:
1- HTML form along with Javascript display to user
2- User input will be validate in the client side by javascript before
pass to CGI script
3- If valid, then it will save the user input into the database.
I think the third method is more faster then other method, but it has
one problem if the javascript disable in the client.
How do you think about the best method to implement this?
The best method is always to validate on both sides. You can't trust that
your input will come from a browser, so never blindly assume that because
your script is processing it it must be valid. It will also minimize your
server load to validate on the client side, and users generally prefer to
know right away that their input is invalid and not wait for the server to
process the page and send it back every time. Use javascript for the client
and perl on the server and get the notion of mixing languages together out
of your head.
Matt
.
- References:
- Perl output Javascript to validate user input
- From: phal
- Re: Perl output Javascript to validate user input
- From: Matt Garrish
- Re: Perl output Javascript to validate user input
- From: phal
- Perl output Javascript to validate user input
- Prev by Date: Re: Catching Apache Errors in Perl
- Next by Date: Re: Reading Image Contents
- Previous by thread: Re: Perl output Javascript to validate user input
- Next by thread: Re: Perl output Javascript to validate user input
- Index(es):
Relevant Pages
|