This week's book giveaway is in the Object Relational Mapping forum.
We're giving away four copies of Pro JPA 2: Mastering the Java Persistence API and have Mike Keith and Merrick Schincariol on-line!
See this thread for details.
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JSP
 
RSS feed
 
New topic
Author

Server-side validation

Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Messages: 150

Hello ranchers,

I have an application in which I have to do a server-side validation. It happens because according to the selected project (entity) in a drop-down list a certain period of date (text box) is allowed. My problem is that I can't keep the fields with the value inserted if that validation occurs to return false. How can I "save" the values in the fields so when the validation completes they still have them?
Bear Bibeault
Author and opinionated walrus
Sheriff

Joined: Jan 10, 2002
Messages: 36372

Use the input elements' value attribute to set the initial value of the controls when you return to the page after failing validation.

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Messages: 150

That's what I have in mind. My problem is where (and how) do I store the values typed by the user before he had clicked the confirm button. The fields are initially blank.
Bear Bibeault
Author and opinionated walrus
Sheriff

Joined: Jan 10, 2002
Messages: 36372

Why do you care what's in the fields before submission? Only the values that are submitted are important -- and you obviously have those in hand as you are validating them.

This message was edited 1 time. Last update was at by Bear Bibeault


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Messages: 150

You cleared my mind, thanks.
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JSP
 
RSS feed
 
New topic
The most intelligent Java IDE