syg6
Aug 14th, 2007, 05:12 AM
I have a couple objects, Company and Employee. CRUD of these objects works fine. But there is a 1:n relationship between Company and Employee. So on my Company 'form' page I have all the data for the Company, as well as a list of Employees. I need to be able to add Employees to and delete Employees from my Company, as well as be able to edit any Employee.
What I am confused about is how to make validation work in one way when I save or update a company (make sure required fields are filled in correctly, make sure at least one Employee is assigned) and to work in another way when I assign an Employee to a Company (only make sure an Employee is selected). When I assign an Employee I would do it in a different page or a pop-up window, with a list of potential Employees, but with the same Command Object, Company.
Since I define my validation for Company in validation.xml, validation would fail since all the rest of the fields are null, since they are not present.
So how do I tell Spring to sometimes validate one way, sometimes another?
Thanks!
Bob
What I am confused about is how to make validation work in one way when I save or update a company (make sure required fields are filled in correctly, make sure at least one Employee is assigned) and to work in another way when I assign an Employee to a Company (only make sure an Employee is selected). When I assign an Employee I would do it in a different page or a pop-up window, with a list of potential Employees, but with the same Command Object, Company.
Since I define my validation for Company in validation.xml, validation would fail since all the rest of the fields are null, since they are not present.
So how do I tell Spring to sometimes validate one way, sometimes another?
Thanks!
Bob