You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Aaron Longwell <li...@newmedialogic.com> on 2003/07/12 00:16:23 UTC

Validator + Problem

I feel a little embarrased asking this question... it seems so simple...

I'm having a problem when the Validator framework actually finds a 
validation error. My form contains a dynamically created drop-down. For 
correct data, the form works just fine.

When the user submits bad data, however, they get a page with their 
errors described (<html:errors/> ), but the drop down now has no values 
in it.... and thus the cannot ever submit good data again.

When I noticed the problem, my setup included a 
request.setAttribute("listitems", items) to insert the collection in the 
Action (on my "edit" action). I realized that this process probably did 
not occur following an HTTP submit to the "update" action. So my 
solution was to put a Collection object in the ActionForm.... then 
populate the drop-down with the ActionForm's collection.... thinking 
that the ActionForm object gets passed into the Action.... shouldn't the 
data be there?

The real question is... how do I repopulate the "n" values in a 1:n 
relationship on a form? I think I'm becoming confused with the lifecycle 
of the ActionForm object, especially with regard to what is happening on 
a submit..... where do I insert form setup code that will run both when 
the user requests the form and when the user receives the form back 
after submitting invalid entries?

Thanks for the help,
Aaron


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