2012-03-26 10 views
3

ワンクリックでコマンドボタンを無効にしているときに問題が発生しています。私はこれのためのアクション機能を使用していますが、うまく動作しない理由を知らないのですか? 私は間違っている場合は、私のコードを修正するために助けてください任意の身体ですか?ワンクリックでコマンドボタンを無効にする

<script> 
    function validationRule(){ 
    savePost(); 
    } 
    </script> 

VFコード:

<apex:actionStatus startText="Loading..." stopText="" id="str"> </apex:actionStatus> 
       <apex:actionRegion > 
         <apex:actionFunction name="savePost" action="{!save}" rerender="" status="str" > 
         </apex:actionFunction> 
       </apex:actionRegion> 
<apex:commandButton image="{!URLFOR($Resource.Test, 'Post_Button.png')}" value="Post" onclick="validationRule();" /> 

コマンドボタンの上にdisabled属性を設定していないように見えます。..

答えて

6

私を修正してください。 this.disabled=true;またはthis.disabled="disabled";を使用してください。

これを試してみてください:

<apex:page standardcontroller="Account"> 
    <apex:form > 
     <script type="text/javascript"> 
      function validate() { 
       // validate code here 
       savePost(); 
      } 
     </script> 
     <apex:actionfunction name="savePost" action="{!save}" rerender="" status="str" /> 
     <apex:commandbutton value="Save New Account Value" onclick="this.disabled='disabled'; validate();" /> 
     <apex:actionstatus startText="Loading..." stopText="" id="str" /> 
    </apex:form> 
</apex:page> 
関連する問題