You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Je...@nlgroup.ca on 2002/10/29 19:54:40 UTC

Advice needed on dynamic list forms.

Greetings:
I know this is done many times before.
My requirement is to display a list of records where one of the columns is
text box.

The actual datastructure is  a list of dual lists..

I have a List of wrapper objects that each contains two Lists.
The internal list are value objects with non String values.
All columns are readonly data except for one editable currency field.

Wrapper
      customerWrapper1
            voList1
            voList2

      customerWrapper2
            voList1
            voList2

So far I have all of this working and auto populating at request time. The
problem is validation.

What I have done so far is:
1 - The two wrapper objects use the commons ListUtils.lazyList()
2 - The page is rendered with nested tags (very easy!)
3 - upon submit, the datastructure gets repopulated and the amount field
gets converted to a Float, all automatically.

I was quite happy how clean this all was until I realized that I still want
to validate the  text value and redisplay the bad input in the list.

By the time the validate method in the form is called, the list is already
repopulated. If the Amount field is Bad input it would be converted to 0.0.
So I need access to the field before is get converted.

I should mention that  I have no ability alter the data structure form the
backend, so I can only wrap or convert...

******** Has anyone got any advice?  ****************

In an effort to get this going..
I am in the proccess if wrapping each value object inside another value
object that contains a single String property and the vo.
I will iterate throught each of the lists and validate each entry, then
when sending to the back end, also iterate and convert  each value.

I am using 1.1b2 but am not using the validator.






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