You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Doug Dates <hi...@yahoo.ca> on 2002/11/24 21:35:40 UTC

delay user input validate....

Hi, All:

I have a problem related to user input validation. I searched on the web, it seems that I couldn't get a clue. Hopefully, you can help me out.

I have two screens: screen1 and screen2. The two screens are used for new user registration.

On screen1, there are three fields: userName, password and confirmPassword. There is also a "Continue" button on the screen1.------Validation rule: userName should be unique. password and confirmPassword should be same.

On screen2, there are user imformation fields, such as street, city, etc. And there is a  "Submit" button.

When user click on "Continue" on the screen1, the screen2 will be displayed, even though there are input errors on screen1. The validation of the input on screen1 will be delayed until user click "Submit" button on screen2. If one(or all) of the fields are invalid (on screen1), the screen1 will be displayed with original input, plus relevant error message. If there are also error messages on screen2, their display should be delayed until the user fixed the errors on screen1, click "continue" to go to screen2(fields on screen2 prepopulated with original input) clicks "Submit", in this case, controls back to screen2 with error messgaes and pre-entered data.

The above senario is business required. 

How can I achieve this using struts(1.1.b). I know in struts, we can use actionForm, validation, struts-config.xml, and etc. But how should I combine them together to acheive the above senario. I really need your help. Thank you in advance for your help.

Sincerely,

Doug


RE: delay user input validate....

Posted by Vipul Sanghi <vi...@zimono.com>.
I think you can achieve this by doing the following:

1.  The Form bean has to have elements of all the parameters of the User
registration (screen 1 and screen2).  This formbean has to be of session
scope that is how you can delay the validation of the input till the second
screen.
2.  The action on the screen1 should not have any validation, it should also
not commit the bean but just forward to screen2 (forward action).  The
action on screen2 should have all the validation you want.  then depending
of the type of error forward either to the screen1 or screen2.

PS. One intutive approach to satisfy your business requirements could be to
save you some headache is on screen2 after the user presses (Save/Done)
display the fields from screen1 and screen2 with errors.  So you would not
have to do any custom forwarding on errors and just have to put an if
condition for the portion of scree2 which has screen1 elements to only
display when there is an error.

Hope this helps.  We have done something similar.

Vipul

-----Original Message-----
From: Doug Dates [mailto:hinbsls@yahoo.ca]
Sent: Monday, November 25, 2002 4:36 AM
To: Struts Users Mailing List
Subject: delay user input validate....


Hi, All:

I have a problem related to user input validation. I searched on the web, it
seems that I couldn't get a clue. Hopefully, you can help me out.

I have two screens: screen1 and screen2. The two screens are used for new
user registration.

On screen1, there are three fields: userName, password and confirmPassword.
There is also a "Continue" button on the screen1.------Validation rule:
userName should be unique. password and confirmPassword should be same.

On screen2, there are user imformation fields, such as street, city, etc.
And there is a  "Submit" button.

When user click on "Continue" on the screen1, the screen2 will be displayed,
even though there are input errors on screen1. The validation of the input
on screen1 will be delayed until user click "Submit" button on screen2. If
one(or all) of the fields are invalid (on screen1), the screen1 will be
displayed with original input, plus relevant error message. If there are
also error messages on screen2, their display should be delayed until the
user fixed the errors on screen1, click "continue" to go to screen2(fields
on screen2 prepopulated with original input) clicks "Submit", in this case,
controls back to screen2 with error messgaes and pre-entered data.

The above senario is business required.

How can I achieve this using struts(1.1.b). I know in struts, we can use
actionForm, validation, struts-config.xml, and etc. But how should I combine
them together to acheive the above senario. I really need your help. Thank
you in advance for your help.

Sincerely,

Doug






--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>