Salesforce Visualforce页面传递JS变量给Controller

参考:

https://salesforce.stackexchange.com/questions/24666/how-to-pass-javascript-value-to-controller

例如

public with sharing class RoseRichEditorController {

    //html内容
    public String text{set;get;}

    public RoseRichEditorController() {

    }

    public PageReference  save(){
        System.debug('获取到html内容:'+text);
        return null;
    }
}
<apex:actionFunction name="passStringToController" action="{!save}" rerender="theForm">
     <apex:param name="p1" value="" assignTo="{!text}" />
 </apex:actionFunction>
 <apex:commandButton value="Test me" onclick="passStringToController(editor.txt.html()); return false;" />

猜你喜欢

转载自blog.csdn.net/rosechan/article/details/79420905
今日推荐