Kp *_*pta 3 salesforce visualforce
单击一次后禁用命令按钮时遇到问题.我正在使用动作功能,但它不能正常工作,不知道为什么?如果我错了,请帮我纠正我的代码吗?
<script>
function validationRule(){
savePost();
}
</script>
Run Code Online (Sandbox Code Playgroud)
代码:
<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();" />
Run Code Online (Sandbox Code Playgroud)
请纠正我..
看起来您没有在命令按钮上设置disabled属性.使用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>
Run Code Online (Sandbox Code Playgroud)