-
Nov 20th, 2012, 09:40 PM
#1
Dynamic Second Ajax drop down list not populating when validation fails (JSR 303)
Hi,
First upon I am a newbie in Spring MVC and JSR 303. I am developing an application which has two dropdown lists. Onchange of first drop down list an ajax request will be fired and second drop down list get populated. I am using JSR 303 hibernate implementation to validate user inputs. The problem is: when validation fails the second dropdown list is not sustaining the value selected by the user. Can anyone advise on this:
My first thought was to use an ajax request to validate inputs before submitting the page to server. Is this the right apparoach or is there any other alternatives?
Any suggestions will be much appreciated, Thanks in advance
my jsp code:
<div style="margin: 20px 20px 20px 20px; clear:">
<form:select path="manufacturer" id="manufacturer" onchange="getModels()">
<form:option value="NONE" label="--- Select ---" />
<form:options items="${manufacturers}" itemValue="id" itemLabel="name"/>
</form:select>
<form:errors id="error" path="manufacturer" />
</div>
<div style="margin: 0px 107px 0px 32px; clear:">
<form:select path="vehicleModel" id="model" >
<form:option value="NONE" label="--- Select ---" />
<form:options items="${vehicleModels}" itemValue="id" itemLabel="name"/>
</form:select>
<br><form:errors id="error" path="vehicleModel" />
</div>
Thanks
opentotech
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules