function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
eliotstock2eliotstock2 

component ID going into name attribute not id attribute

Hi.

 

I am finding that this inputField tag in my Visualforce page:

 

 

<apex:pageBlock mode="edit" id="block"> <apex:pageBlockSection title="Data Collection" columns="1" id="dataCollection"> <apex:inputField value="{!metric.Is_Cumulative__c}" required="true" id="isCummulative"/> ...

 


 

 

produces this HTML:

 

 

<select id="j_id0:j_id2:j_id3:j_id42:j_id43" name="j_id0:j_id2:block:dataCollection:isCummulative">

 

 which means that I can't find the document element like so:

 

 

var cummulativeDropdown = document.getElementById('{!$Component.block.dataCollection.isCummulative}');

 

 It looks to me like the name attribute has been set to what should be in the ID attribute. Any ideas anyone?

 

Thanks.

 

 

Ron HessRon Hess

you would only need this

 

var cummulativeDropdown = document.getElementById('{!$Component.isCummulative}');