| Author |
J2EE struts validation: required field in bullet and pop up error message displayed
|
Chew Wei Kian
Greenhorn
Joined: Sep 11, 2011
Posts: 2
|
|
I am having a problem here. I want the testfield to be a "required" textfield. When i submit the form with testfield blank, a pop up message validator was displayed. But when i add some text into the testfield and submit the form, a bullet point error was displayed on the html. I do not need the bullet point error message. Does anyone have any idea how to solve this? Any help would be appreciated. Thanks! =)
******** my form ****************
<html:errors/>
<html:form action="/Report.do" method="post" onsubmit="return validateMyForm(this)">
<bean:message key="retrieval.testfield"/>
<html:text property="testfield" name="testfield" size="12" value=""/>
</td>
<html:submit property="generate" styleClass="buttonlabel" value="Generate Report" />
<html:javascript formName="MyForm" />
</html:form>
********* my struts config xml *************
<!-- ======================================== Application Resources Definitions -->
<message-resources parameter="ApplicationResources" />
<!-- =================================================== Validator plugin -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml" />
</plug-in>
********* validation.xml *************
<form name="MyForm">
<field
property="testfield"
depends="required">
<arg0 key="MyForm.testfield"/>
</field>
</form>
********* ApplicationResource.properties *************
retrieval.testfield=this is a TestField:
error.testfield.required=TestField is required
MyForm.testfield=TestField
|
 |
 |
|
|
subject: J2EE struts validation: required field in bullet and pop up error message displayed
|
|
|