trx
trx

Reputation: 2157

Pass the parameter from the VF page to command button action

I have the VF Page and through a custom button I am passing the parameter To the VF URL as https://abc--c.cs41.visual.force.com/apex/Send_Env_Email?OppId=00655D0Z8 I want to retrieve this within the same page so I can pass it in the command button so call the other controller method

<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>

Because the send() within test_Controller1 is looking for the input parameter Public void send(set<id> oppIds)

Upvotes: 0

Views: 2122

Answers (2)

eyescream
eyescream

Reputation: 19622

In pure Visualforce that parameter should be available in {!$CurrentPage.parameters.OppId}

But looks like for your use case it's better to do what Psymn suggested, just grab the value in constructor, save to some helper String variable and it should be visible in whole class.

Upvotes: 0

Psymn
Psymn

Reputation: 382

If I'm understanding correctly what you are trying to accomplish; You don't need to pass it from the page to the controller. You can access url parameters in the controller.

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

You can then use the oppID to attach to the page you will be redirecting the user to.

Upvotes: 2

Related Questions