+ Start a Discussion
GobbledigookGobbledigook 

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

 

 

etc.

 

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:

 

 

/a0F/e?CF00NA0000004riGC_lkid={!Open_Quotes__c.AccountId__c}&CF00NA0000004riGC={!Open_Quotes__c.Account__c}&00NA0000004rmIC={!Open_Quotes__c.Date}

 

 

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:

 

 

id="j_id0:theForm:thePageBlock:j_id15:j_id19"

 

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?

 

jeremyyjeremyy

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

http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_best_practices_accessing_id.htm#kanchor615 

 

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:

http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_quick_start_query_params_getting.htm#kanchor144 

 

Jeremy

Pradeep_NavatarPradeep_Navatar

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.