You need to sign in to do that
Don't have an account?
Will Edwards
What's wrong with this use of inputHidden?
I'm trying to fill a hidden custom field through a parameter provided via the URL in a Visualforce page on a Force.com site that creates leads. I'm getting the following error: "Error: Literal value is required for attribute id in apex:inputHidden in NomineeRegistration at line 38 column 99."
Here's my Apex:
And the highlights of the VF page:
Here's my Apex:
public class myWeb2LeadExtension { private final Lead weblead; public myWeb2LeadExtension(ApexPages.StandardController stdController) { weblead = (Lead)stdController.getRecord(); } public PageReference saveLead() { try { insert(weblead); } catch(System.DMLException e) { ApexPages.addMessages(e); return null; } PageReference p = Page.ThankYou; p.setRedirect(true); return p; }
And the highlights of the VF page:
<apex:page standardController="Lead" extensions="myWeb2LeadExtension" title="Register for Digital Accelerator" showHeader="false" standardStylesheets="true"> <apex:composition template="{!$Site.Template}"> <apex:define name="body"> <apex:form > <apex:messages id="error" styleClass="errorMsg" layout="table" style="margin-top:1em;"/> <apex:pageBlock title="" mode="edit"> <apex:pageBlockButtons > <apex:commandButton value="Submit" action="{!saveLead}"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Register for Digital Accelerator" collapsible="false" columns="1"> <div class = "requiredInput"> <div class = "requiredBlock"></div> <apex:inputField value="{!Lead.FirstName}" required="true"/> <apex:inputField value="{!Lead.LastName}" required="true"/> <apex:inputField value="{!Lead.Nickname__c}" required="false"/> <apex:inputField value="{!Lead.Title}" required="true"/> <apex:inputField value="{!Lead.Email}" required="true"/> <apex:inputField value="{!Lead.Company}" required="true"/> <apex:inputField value="{!Lead.Phone}" required="true"/> <apex:inputField value="{!Lead.Mailing_Address__c}" required="true"/> </div> <apex:inputHidden id="{!Lead.Referred_By__c}" value="{!$CurrentPage.parameters.Referred"/> </apex:pageBlockSection> </apex:pageBlock>
All Answers
Just checking in to see if you got your issue resolved with your inputHidden element. If so, and my answer helped, please mark as 'Best Answer'. if you solved this on your own, please comment on your solution, and mark your comment as 'Best Answer' so that this can be marked as solved. Keep the community alive! Thanks!