首页 > 解决方案 > 将参数从 VF 页面传递到命令按钮操作

问题描述

我有 VF 页面并通过自定义按钮将参数传递给 VF URL,因为https://abc--c.cs41.visual.force.com/apex/Send_Env_Email?OppId=00655D0Z8我想在同一页面中检索它,因此我可以在命令按钮中传递它,以便调用其他控制器方法

<apex:page  controller="test_Controller1">
  <apex:form >
      <apex:pageBlock >
         <h1>Send a Signing Request via Email</h1>
         <p>This form will send a DocuSign signing request. 
         Are you sure you want to send it?</p> 
         <p><apex:commandButton action="{!send}" onclick="clicked();" rerender="dssdk_output" value="Send!" /></p>
      </apex:pageBlock>  
  </apex:form>

因为inside 是send()test_Controller1寻找输入参数Public void send(set<id> oppIds)

标签: salesforceapexvisualforce

解决方案


如果我正确理解您要完成的工作;您不需要将它从页面传递给控制器​​。您可以在控制器中访问 url 参数。

public pageReference send()
{
   String oppID = ApexPages.CurrentPage().getParameters().get('OppId');
   --Rest of your code here --
}

然后,您可以使用 oppID 附加到您将用户重定向到的页面。


推荐阅读