• df_ritu
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

Hi, 

 

I am looking to pass the parameter passed through the URL ../apex/New_Lead?msg=test into a custom field called Web_Lead_Source__c.

 

Below is my code:

<apex:page standardController="contact" extensions="setValfromURL" >
Your page redirected from: {!message}<br/>
<!-- {!$CurrentPage.URL}<br/>-->
<!--{!$CurrentPage.parameters.msg}-->
<apex:sectionHeader title="New Lead"/>
<apex:form >
<apex:pageBlock title="Information" mode="edit">

<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="Submit"/>
<apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Contact Information">
<apex:inputField id="contactFirstName" value="{!contact.firstName}"/>
<apex:inputField id="contactLastName" value="{!contact.lastName}"/>
<apex:inputField id="contactPhone" value="{!contact.phone}"/>
<apex:inputField id="Source" value="{!contact.Web_Lead_Source__c}"/>
<apex:inputField id="Medium" value="{!contact.Web_Lead_Medium__c}"/>
<apex:inputField id="contactEmail" value="{!contact.email}"/>
<apex:inputText id="Source1" value="{!message}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

public class setValfromURL {
private ApexPages.StandardController controller;
public setValfromURL(ApexPages.StandardController controller) {
this.controller = controller;
}
public String getMessage(){
String a = ApexPages.currentPage().getParameters().get('msg');
return a;
}

 }

 

The first reference to {!message} works fine but the second reference to {!message} gives an error : Error: Read only property '[setValfromURL].message'

 

I am also able to use {!$CurrentPage.parameters.msg} to display the parameter value, but I am not able to pass it into the inputText.

 

Please advice.

Thanks,

Ritu