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
Gino BassoGino Basso 

outputLabel not associated with component due to incorrectly generated id

Clicking the label in the following VF page does not set the focus to the inputText component. When you examine the generated HTML you observe that the id of the for attribute in the outputLabel is incorrect.



apex:page standardController="MyObj__c"> <apex:form > <apex:pageBlock mode="edit"> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> </apex:pageBlockButtons> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockSection title="Information" showHeader="true"> <apex:pageblockSectionItem > <apex:outputLabel for="typeInput" value="Type"/> <apex:outputPanel id="typePanel"> <apex:actionStatus id="typeStatus"> <apex:facet name="start"> </apex:facet> <apex:facet name="stop"> <c:inputPanel fieldLabel="Type" fieldRequired="true" errorVar="typeError"> <apex:inputText id="typeInput" value="{!MyObj__c.Type__c}" styleClass="{!typeError.errorStyleClass}"/> </c:inputPanel> </apex:facet> </apex:actionStatus> </apex:outputPanel> </apex:pageblockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>


If I remove the inputPanel custom component then it works. If I move the inputPanel custom component (and its content) outside of the actionStatus but inside outputPanel (id=typePanel) it also works (which suggests to me that there is not an issue with the custom component).


It almost seems that if the component you want to associate the label with is far enough away the id does not generate correctly.


This behaviour was observed in API 16.