zl程序教程

您现在的位置是:首页 >  其它

当前栏目

SFDC ActionFunction

2023-06-13 09:14:31 时间
<apex:page controller="myController">
    <script> 
    myActionMethod(); //this is javascript
    </script>
    <apex:form>
            <!-- this is an apex/vf method that will be call-able from JS -->
            <apex:actionFunction name="myActionMethod" 
                                 action="{!submitEmp}" />
             <!-- the action attribute is the apex controller method you want to call -->
    </apex:form>
</apex:page>


public class myController{
    public void submitEmp(){
        EMPTest__c c= new EMPTest__c();
        insert c;
   }
}

要点:
1:里的方法不是直接调用而是通过FunctionAction来传递调用。
2:现在来看在Component里不好用,要移到Page定义里。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/201621.html原文链接:https://javaforall.cn