I have a form where users add data-entry rows and fill out data about an order item. Rows can be added or deleted.
I've defined an OrderForm (a bean, extends ValidatorActionForm) that has an ArrayList of OrderItem beans. The idea is that as rows of order items are added by the user, the ArrayList<OrderItem> captures them.
The form works well, but, when I run with validation, I get bizarre behavior:
- if a user submits a blank row or sets of fields, validation works. But if the user decides to delete that row and resubmit, the validation behaves as if the row were still present and kicks out a validation asking for field values. Even if I add a row, I can't get out of this loop... I have to logout and restart a new session to enter data.
It seems that the ActionForm is out of sync with the UI. I've tried placing the form in session scope and request scope... same problem.
Any idea what is going on? My impression is that a new form should be submitted, but it's acting like the old one is.
I think I'm unclear on the order of operations for validation-- is it:
1.) instantiate bean
2.) run validator
3.) if validator passes, then process to the next Action
4.) if validator fails, then kick back to prior jsp?