javascript
  • liferay-6
  • liferay-aui
  • 2013-06-26 23 views 1 likes 
    1

    我有一個用戶信息表單,其中我的表單中有合金aui按鈕。如果任何aui表單字段值發生變化,請啓用aui按鈕

    <aui:form action="<%=saveUser%>" method="post" id="saveUserForm" name="saveUserForm" onSubmit='<%= "event.preventDefault(); " + renderResponse.getNamespace() + "saveUserForm();" %>' > 
    
    <aui:fieldset > 
        <aui:input inputCssClass="aui-field-required" id='empType' name="empType" label="Emp Type (Required)" value='<%= (type!=null)?type.getEmpType():"" %>' /> 
        <aui:select label="state" name="regionsIDS" /> 
    </aui:fieldset> 
    
    <aui:fieldset> 
          <aui:input type="checkbox" 
            id="novalue1" 
            name="novalue" onClick="myFunction()" 
            checked="<%= multipleAdmin%>" > 
           </aui:input> 
          </aui:fieldset> 
    
    <aui:button-row> 
           <aui:button type="submit" value="Save and Continue" cssClass="btn-xl btn-blue" disabled="true"/> 
          </aui:button-row> 
    

    我已經將它的屬性disabled =「true」設置爲禁用。 現在我想要啓用此按鈕,如果我的任何輸入文本框或複選框的值被更改。

    所以,我該怎麼辦啓用我AUI按鈕,如果上述任何輸入文字或 下拉或複選框的值被改變了嗎?

    回答

    2

    onchange of dropwdonw或textfiled change event do following。

    var btn = "get your button from its id here"; 
        btn.set('disabled', false); 
        btn.ancestor('.aui-button').removeClass('aui-button-disabled'); 
    

    讓我們嘗試this.i還沒有試過,但希望它可以幫助你 只是把id屬性在<aui:button >並使用其ID得到BTN上述

    +0

    燁作爲解釋,其working..Thanks – Java

    +0

    大享受編碼.. –

    相關問題