You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jon Wynacht <jo...@objectevolution.com> on 2008/03/09 01:31:26 UTC

Advice on Handling From Validation

Hi,

I have the following scenario running with an application:

1. A setup action gets called and a form bean gets created, some  
lists in the form bean are populated with collections and then the  
whole mess gets sent to the user.

2. The user fills out the form and clicks save.

3. A save action gets called but before that, validation happens (the  
form bean extends ValidatorForm) and finds the user forgot to enter a  
title. The user is forwarded to the form jsp to correct the error but  
the collections are no longer available.

4. Huge error ensues, user is mad, money is lost.

After doing some research it seems that I have a couple of options:

1. When validation fails, return the user to an action instead of  
directly to the jsp. Said action can repopulate the list and things  
are good to go.

2. Session scope the form bean.

3. Use AJAX to populate the collections on the form and forgetaboutit.

Are there best practices for this sort of thing? Am I missing  
anything else?

Thanks in advance for your help.

Cheers,

Jon

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Advice on Handling From Validation

Posted by Jon Wynacht <jo...@objectevolution.com>.
Yup. That's pretty much the case. I like the validation framework and  
have been using it for a while. I run into these cases where I need  
to repopulate collections within the form.

Javascript is a good alternative for sure, especially given JQuery  
and other libraries which make it easy to do that. I'll probably go  
that path for now.

Thanks,

Jon

On Mar 8, 2008, at 6:43 PM, Peters, John wrote:

> Why not use JavaScript for preliminary validation of the form?
> Sounds like your main issue is a user not entering a value in a field.
>
>
> -----Original Message-----
> From: Jon Wynacht [mailto:jon@objectevolution.com]
> Sent: Sat 3/8/2008 7:31 PM
> To: user@struts.apache.org
> Subject: Advice on Handling From Validation
>
> Hi,
>
> I have the following scenario running with an application:
>
> 1. A setup action gets called and a form bean gets created, some
> lists in the form bean are populated with collections and then the
> whole mess gets sent to the user.
>
> 2. The user fills out the form and clicks save.
>
> 3. A save action gets called but before that, validation happens (the
> form bean extends ValidatorForm) and finds the user forgot to enter a
> title. The user is forwarded to the form jsp to correct the error but
> the collections are no longer available.
>
> 4. Huge error ensues, user is mad, money is lost.
>
> After doing some research it seems that I have a couple of options:
>
> 1. When validation fails, return the user to an action instead of
> directly to the jsp. Said action can repopulate the list and things
> are good to go.
>
> 2. Session scope the form bean.
>
> 3. Use AJAX to populate the collections on the form and forgetaboutit.
>
> Are there best practices for this sort of thing? Am I missing
> anything else?
>
> Thanks in advance for your help.
>
> Cheers,
>
> Jon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>
>
>
> Blue Cross Blue Shield of Florida, Inc., and its subsidiary and  
> affiliate companies are not responsible for errors or omissions in  
> this e-mail message. Any personal comments made in this e-mail do  
> not reflect the views of Blue Cross Blue Shield of Florida, Inc.   
> The information contained in this document may be confidential and  
> intended solely for the use of the individual or entity to whom it  
> is addressed.  This document may contain material that is  
> privileged or protected from disclosure under applicable law.  If  
> you are not the intended recipient or the individual responsible  
> for delivering to the intended recipient, please (1) be advised  
> that any use, dissemination, forwarding, or copying of this  
> document IS STRICTLY PROHIBITED; and (2) notify sender immediately  
> by telephone and destroy the document. THANK YOU.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Advice on Handling From Validation

Posted by "Peters, John" <Jo...@bcbsfl.com>.
Why not use JavaScript for preliminary validation of the form?
Sounds like your main issue is a user not entering a value in a field.


-----Original Message-----
From: Jon Wynacht [mailto:jon@objectevolution.com]
Sent: Sat 3/8/2008 7:31 PM
To: user@struts.apache.org
Subject: Advice on Handling From Validation
 
Hi,

I have the following scenario running with an application:

1. A setup action gets called and a form bean gets created, some  
lists in the form bean are populated with collections and then the  
whole mess gets sent to the user.

2. The user fills out the form and clicks save.

3. A save action gets called but before that, validation happens (the  
form bean extends ValidatorForm) and finds the user forgot to enter a  
title. The user is forwarded to the form jsp to correct the error but  
the collections are no longer available.

4. Huge error ensues, user is mad, money is lost.

After doing some research it seems that I have a couple of options:

1. When validation fails, return the user to an action instead of  
directly to the jsp. Said action can repopulate the list and things  
are good to go.

2. Session scope the form bean.

3. Use AJAX to populate the collections on the form and forgetaboutit.

Are there best practices for this sort of thing? Am I missing  
anything else?

Thanks in advance for your help.

Cheers,

Jon

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org







Blue Cross Blue Shield of Florida, Inc., and its subsidiary and affiliate companies are not responsible for errors or omissions in this e-mail message. Any personal comments made in this e-mail do not reflect the views of Blue Cross Blue Shield of Florida, Inc.  The information contained in this document may be confidential and intended solely for the use of the individual or entity to whom it is addressed.  This document may contain material that is privileged or protected from disclosure under applicable law.  If you are not the intended recipient or the individual responsible for delivering to the intended recipient, please (1) be advised that any use, dissemination, forwarding, or copying of this document IS STRICTLY PROHIBITED; and (2) notify sender immediately by telephone and destroy the document. THANK YOU.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org