【发布时间】:2012-06-06 18:49:25
【问题描述】:
所以我创建了一个自定义搜索页面,允许我按任何字段搜索客户,并且所有字段都是可选的。为此,我必须创建一个自定义 <form:find> 标记并注释掉这一行:
<!-- <script type="text/javascript">Spring.addDecoration(new Spring.ValidateAllDecoration({elementId:'proceed', event:'onclick'}));</script> -->
这允许我提交表单。但问题是:如果我在字段内部单击并在其外部单击,而不输入任何文本,则会弹出“此字段是必需的”验证错误。
我仍然可以提交表单,并且搜索页面可以正常工作,但我想修复这个烦人的不正确错误。
这里是 .jspx
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<div xmlns:field="urn:jsptagdir:/WEB-INF/tags/form/fields" xmlns:form="urn:jsptagdir:/WEB-INF/tags/form" xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<jsp:output omit-xml-declaration="yes"/>
<form:find_without_validation finderName="ByOutputFormatAndStorageDeviceAndWorkOrderAndServiceOffering" id="ff_com_eg_egmedia_bizapp_model_ServiceItem" path="/serviceitems" z="b0NZUow+hQ11Ruy9n/4oyBOWOBs=">
<field:select_optional disableFormBinding="true" field="outputFormat" id="f_com_eg_egmedia_bizapp_model_ServiceItem_outputFormat" items="${outputformatenums}" path="/outputformatenums" required="false" z="user-managed"/>
<field:select_optional disableFormBinding="true" field="storageDevice" id="f_com_eg_egmedia_bizapp_model_ServiceItem_storageDevice" items="${storagedeviceenums}" path="/storagedeviceenums" required="false" z="user-managed"/>
<field:select_optional disableFormBinding="true" field="workOrder" id="f_com_eg_egmedia_bizapp_model_ServiceItem_workOrder" itemValue="id" items="${workorders}" path="/workorders" required="false" z="user-managed"/>
<field:select_optional disableFormBinding="true" field="serviceOffering" id="f_com_eg_egmedia_bizapp_model_ServiceItem_serviceOffering" itemValue="id" items="${serviceofferings}" path="/serviceofferings" required="false" z="user-managed"/>
</form:find_without_validation>
</div>
我的<field:select_optional> 标签只是默认的<field:select> 标签,还有一个额外的<option value="" />
【问题讨论】:
标签: spring dojo spring-roo