You need to sign in to do that
Don't have an account?

Prepopulating a lookup field in visualforce page
Hi All,
I have a look up field as Event Name in my registrant visualforce page.
When a user clicks on this registrant vf page via site , the lookup field Event Name should already have a predefined value in it .How is it possible ?
Can we change the url of vf page in such a way that the look up field will contain the value we want ?
I'm not sure I have this right, but it's my impression that you have a custom Registrant object with a custom lookup to another object, and you want to have a VF page that starts a new Registrant, with the lookup( Event Name) already filled in, waiting for the user to enter the rest of the information.
I think this would be done through a custom controller or controller extension. If it needs to be filled in dynamically, you could use a URL parameter (/apex/NewRegistrant?event=[the event Id]). Are you already using a custom controller or extension? Let us see your existing code if you have some.
Jeremy
Hi,
I do have a custom controller .It inserts the record and directs it to a thanks page when register button is clicked.
I was trying by url parameters ..but could not do it .
Suppose the event id is =a06S0000002VZM3
so in my page i was trying https://cs1.salesforce.com/apex/EventRegister?event=a06S0000002VZM3
Can you please give me some example how to use url param to fill this look up field automatically.
My controller is
I added some lines to your code to keep track of the registrant as soon as the controller extension starts working. The new Registrant is initialized with the ID of your Event__c already, which should then fill in the field automatically. See if this makes sense. I didn't compile, so there may be typing errors.
Jeremy