+ Start a Discussion

Getting Ids of overridden fields

Ok, so I have a problem:


I have a VF page overriding a standard Edit page that references some of the standard fields. 

  <apex:pageBlockSection title="{!$ObjectType.Report__c.label} Information" columns="1">
                <apex:inputField value="{!Report__c.Account__c}"/>
                <apex:inputField value="{!Report__c.Date__c}" required="true"/>





I also have a Custom Button on another page that references the Ids of these fields to auto fill them on creation from said button:






Now, to get the Ids (those are just placeholders) from the input fields, I have to view the source of the Edit page, and find the Ids themselves.  Problem is, now they're something like:





And if I try to reference that mess, it doesn't work anyway.  The original Ids I took from the original page before it was overridden, but that still didn't work. I need these fields to be auto filled.  Any ideaS?



If you're not already familiar with the $Component global variable, check it out 



However, it looks like you're referencing fields on one page from another page, and $Component probably won't help you with that. To my knowledge, there is not support built in to VF pages for passing field values in the URL.


The typical approach to this is to pass the values in the URL with parameter names of your choosing, then extract these values in the controller's constructor and use the values to populate properties of the controller. Finally, you bind the VF components to the controller properties with the value="{!someControllerProperty}" syntax.


If you don't want to bother with using the controller to control these values, you can use the $CurrentPage variable to pull the querystring parameter values directly into the VF page:





As suggested by your context "j_id0:theForm:thePageBlock:j_id15:j_id19" in which pageid:formid:Pageblockid: Pageblocktableid: componentid. You should provide all id's for reference the  visual force component.