当前位置: 代码迷 >> 综合 >> Salesforce Visualforce页面传递JS变量给Controller
  详细解决方案

Salesforce Visualforce页面传递JS变量给Controller

热度:3   发布时间:2023-12-19 01:59:33.0

参考:

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;" />
  相关解决方案