1
我有一個表單和一個必填字段,如下所示。 如果必填字段爲空,我添加了aui字段驗證器以防止表單提交。 但它不工作。 有人請幫助我。如何防止aui-form提交,當aui要求提交驗證器爲空時
<aui:form id="fm" name="fm" method="post" action="<%= someURL %>">
<aui:input id="txtArea" label="value" name="preferences--txtArea--" type="textarea" style="width:330px;height:65px;" >
<aui:validator name="required" />
</aui:input>
<aui:input name="termsAndCondition" id="termsAndCondition" type="checkbox" label="termsAndConditons"/> <br>
<aui:button type="button" value="save" onClick="showDialog()" />
</aui:form>
<aui:script>
function showDialog()
{
var termsAndCondition= A.one('#<portlet:namespace/>termsAndCondition').attr('value');
var r=confirm("Are you sure to change data?");
if (r==true && termsAndCondition=="true")
{
A.one('#<portlet:namespace/>fm').submit();
}
}
</aui:script>
可以請你告訴我怎麼在功能檢查(),或在條件返回false從我的函數的ShowDialog()查詢。 – user2341971
只是保持檢查功能,因爲它是..嘗試它 –
我試過了,但它不工作。 – user2341971