Required Fields in JSP forms

L

Lindsay

I am a beginner coder and web designer. I have created a form that
submits it's results via email. This code works. Now I need to add
required fields and validate the form. What would be the best way to
do this?

Thanks for your time!
Lindsay
 
P

Philipp Leitner

Lindsay said:
I am a beginner coder and web designer. I have created a form that
submits it's results via email. This code works. Now I need to add
required fields and validate the form. What would be the best way to
do this?

Thanks for your time!
Lindsay

That will depend heavily on what you want to check, and how complex
these checks are. If possible I would do them on the client side (i.e.
using Javascript). If you are not using plain JSP, but something more
sophisticated like JSF you can usually use the framework to check input
values of forms.

What I would avoid in any case is doing these checks manually on server
side ... these codings can get very ugly otherwise.

/philipp
 
L

Lindsay

I want to do basic validation. Just making sure certain fields have
data in them before submission. I am using plain JSP.
 
O

Oliver Wong

Philipp Leitner said:
As I said before, I would do that stuff with Javascript. That allows
you to do it on the client side, i.e. without reloading the whole page
if some fields are not filled.

Doing a short Google search I have found a promising article that
explains that matter:

http://www.webdevelopersjournal.com/articles/jscript_forms1.html

You'd have to eventually do the checks server side anyway, since there's
always the possibility that the user agent will not support or will ignore
JavaScript.

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top