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
George M AlbrechtGeorge M Albrecht 

Rerendered Inputfield Label Not Displaying (VF)

Hello,

I am trying have an inputfield render based upon what a user selects on another picklist field. The new field is rendering, but blank with no label. Here is the code I have so far..I am missing something simple?

<apex:pageBlockSection columns="3" title="What is this?">
     <apex:inputField value="{!Bug_Enhancement__c.Request_Status__c}"/>
     <apex:inputField value="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c}" label="Is this a New Article or Update to an Existing?">
      <apex:actionSupport event="onchange" reRender="updateinfo"/>
     </apex:inputField>
     <apex:outputPanel id="updateinfo">
     <apex:inputField value="{!Bug_Enhancement__c.Article_Number__c}" label="Article Number?" rendered="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c =='Update'}"/>  
     </apex:outputPanel>
   </apex:pageBlockSection>
   <apex:pageBlockSection title="What categories should we tag this article in?" >
   </apex:pageBlockSection>
   </apex:actionRegion>


Sonam_SFDCSonam_SFDC
Can you try setting rerendered for the outputpanel rather than just for the inputfield, something like this:
<apex:outputPanel id="updateinfo" rendered="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c =='Update'}">
     <apex:inputField value="{!Bug_Enhancement__c.Article_Number__c}" label="Article Number?" /> 
     </apex:outputPanel>

Let me know if this works..
Vinit_KumarVinit_Kumar
It is happening because of Outpupanel,remove the outputPanel and use apex:pageBlockSection  to wrap the field,try something like below :-
<apex:pageBlockSection columns="3" title="What is this?">
     <apex:inputField value="{!Bug_Enhancement__c.Request_Status__c}"/>
     <apex:inputField value="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c}" label="Is this a New Article or Update to an Existing?">
      <apex:actionSupport event="onchange" reRender="updateinfo" status="status"/>
     </apex:inputField>
	 <apex:actionStatus startText="applying value..." id="status"/>  
   </apex:pageBlockSection>
   <apex:pageBlockSection title="What categories should we tag this article in?" >
   </apex:pageBlockSection>
   </apex:actionRegion>
   
      <apex:outputPanel id="updateinfo">
	   <apex:pageBlockSection title="Bug Update" columns="1"  
                   rendered="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c =='Update'}">  
     <apex:inputField value="{!Bug_Enhancement__c.Article_Number__c}" label="Article Number?" />  
	 </apex:pageBlockSection>
     </apex:outputPanel>

If this helps,please mark it as best answer to help others :)


George M AlbrechtGeorge M Albrecht
Thank you both for your responses. 

1) Sonam - I tried that and when I do that, nothing at all renders.

2) Vinit - That will work but I do not want to put this in a new section, I want to keep the new field to be rendered in the same section. Are you saying that is not possible and I will NEED to create a new section to correctly render this field?

George
Vinit_KumarVinit_Kumar
George,

As far as I know,outputpanel has issues with actionsupport rerender attribute and it manipulates with the Label styling.

So,that's why I suggested you to put it inside another apex:pageBlockSection ,you can also try with apex:pageBlockSectionItem,I have not tried with it and let me know if that works.
thsrthsr
you can try this way.If this helps,please mark it as best answer to help others.good luck!

<apex:outputPanel id="updateinfo">
     <apex:outputPanel id="updateinfo2">
     <apex:inputField value="{!Bug_Enhancement__c.Article_Number__c}" label="Article Number?" rendered="{!Bug_Enhancement__c.Update_Existing_or_New_Article__c =='Update'}"/> 
     </apex:outputPanel>
 </apex:outputPanel>


George M AlbrechtGeorge M Albrecht
Vinit & Tjl,

Unfortunately both suggestions produce the same result as I was previously experiencing, where the label is not rerendering. As always I appreciate the feedback though and i'll keep plugging.
George
Vinit_KumarVinit_Kumar
For me it was working,by putting it inside a pageblocksection.Can you verify again ??
Frederic KrebsFrederic Krebs
Thanks Vinit_Kumar ,
it's works near perfectly (just a little left margin) to add a pageBlockSection inside the outputPanel
Cheers