Somehow we lost the list on a couple of posts.
OK, so, these are the things I assume you have checked so far:
1) you have an html:select tag with property = "reportType", and the default option's value is ""
2) your ActionForm extends one of the proper types (such as ValidatorForm) and has the proper getters and setters for the reportType field
3) in struts-config.xml, you have configured the action (the same one that your form will submit to) with validate = true, and you have named the proper ActionForm to associate with the action (one of your form-bean declarations)
4) the field name in validation.xml matches the field name of your select ("reportType"), and the form name in validation.xml matches the same form name that you are associating with the action in struts-config.xml (the name of the form configured in the action matches one of your form-bean declarations)
What else am I leaving out?
Erik
Priya Jotwani wrote:
Yes I have set the validate= "true" in and the field names are same too :(
-----Original Message-----
From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 05, 2004 11:32 PM
To: Priya Jotwani
Subject: Re: Validation in Struts for Required fields
Does the property attribute to html:select have the same value you have specified as the field name in validation.xml ("reportType", "productLine")? Do you have the validate attribute set to "true" in struts-config.xml for the relevant action configuration?
Erik
Priya Jotwani wrote:
values.Hi Erik,
I am using html:select tag like below in my JSP
<html:option value="">Select a Product Line</html:option>
Thanks, Priya
-----Original Message-----
From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 05, 2004 11:04 PM
To: Struts Users Mailing List
Subject: Re: Validation in Struts for Required fields
In your JSP, where are your selects? Are you using html:select tags to produce them?
Erik
Priya Jotwani wrote:
Hi ,
I have a JSP Page where I have two dropdowns displaying default
amBefore submitting that page, the user should select something from
these
two dropdowns and if he doesn't selects, there should be an error message displayed on the top saying "This field is required".
This is what I am doing but it doesn't gives me an error message and
possiblyable to proceed to the next page. Any idea as to what could be
wrong/missing ?
In my validator.xml , I have
<form name="ClientReportingForm">
<!-- Struts validation -->
<field property="reportType" depends="required">
<arg0 key="prompt.reportType"/>
</field>
<field property="productLine" depends="required">
<arg0 key="prompt.productLine"/>
</field>
</form>
In my ApplicationResources.properties I have
<prompt.reportType value= "Report Type"/>
<prompt.productLine value= "Product Line"/>
And in my JSP Page I have
<logic:messagesPresent message="error" >
<bean:message key="errors.header" />
<ul>
<font color="red"><b> <html:messages id="error">
<li><bean:write name="error" filter="false"
/></li>
</html:messages> </b> </font>
</ul>
<bean:message key="errors.footer" />
</logic:messagesPresent>
Thanks,
Priya
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]