Back Forum Reply New

Problem pre-selecting value in form:select when editing

Hi all,

I'm working on a Spring MVC 2.5/Hibernate 3.2.6 project, and I'm running into a problem getting one of my edit forms to work properly.

I have two objects: Project and Client. The Project object has a @ManyToOne association with the Client object (which, in turn has a @OneToMany association to the Project object).

When I display the form to edit a Project, I set up a list of Clients in the controller's referenceData method and display this as a form:select field. The problem is that the current Project's client should be pre-selected in the form:select field, but isn't. I've littered my code with System.err.println statements to verify that the Project's Client object is indeed set correctly and it is...it's just not getting pre-selected. Other than this, the form functions perfectly.

On a related note, the Project object also has a PricingType object with the same relationships as the Project/Client relationships. This is displayed as a form:radiobuttons element instead of a form:select, but other than that there is no difference that I can see. This property is successfully pre-selected when editing a Project.

Any ideas where I should be looking to find the issue here?

Thanks in advance!
¥
Back Forum Reply New