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
NJDevilsFanNJDevilsFan 

Problem with Date Input Fields when they are hidden and then rendered by an event (BUG ???)

When I put a date input field in a pageblock section that is rendered only when certain criteria are met, once the page is rerendered (by the event) and the field appears, the calendar stops showing up when you click on the field. Alternatively, if i put the field in a pageblock section that is always rendered, it shows up fine. Am I doing something wrong? Or missing something? Here is my code:

 

Just to further explain the code: The idea here is that when "existing employee" is choosen in the type of applicant field, a new section appears underneath with a lookup to the account object and the existing badge expiration date field. 

 

 

<apex:page standardController="case" sidebar="false"> <apex:sectionHeader title="Sponsor: {!$User.FirstName} {!$User.LastName}" subtitle="New Badge Request" /> <apex:form > <apex:pageBlock title="Edit Case" id="thePageBlock" mode="edit"> <apex:pageMessages /> <apex:pageBlockButtons location="bottom"> <apex:commandButton value="Submit" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:actionRegion > <apex:pageBlockSection title="Applicant Information" columns="1" collapsible="false"> <apex:pageBlockSectionItem > <apex:outputLabel value="Type of Applicant"/> <apex:outputPanel > <apex:inputField value="{!case.Type_of_Applicant__c}" required="true"> <apex:actionSupport event="onchange" rerender="thePageBlock" status="status"/> </apex:inputField> <apex:actionStatus startText="Updating required fields..." id="status"/> </apex:outputPanel> </apex:pageBlockSectionItem> </apex:pageblocksection> </apex:actionRegion> <apex:pageBlockSection rendered="{!case.Type_of_Applicant__c == 'Existing Employee'}" columns="1"> <apex:pageBlockSectionItem > <apex:outputLabel value="Please lookup the name of the Employee:" rendered="{!case.Type_of_Applicant__c == 'Existing Employee'}" for="AccountName" /> <apex:outputpanel > <apex:inputField value="{!case.AccountID}" id="AccountName"/> </apex:outputpanel> </apex:pageBlockSectionItem> <apex:inputField value="{!case.ID_Badge_Expiration_Date__c}"/> </apex:pageblocksection > </apex:pageblock> </apex:form> </apex:page>

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
jwetzlerjwetzler

<apex:outputPanel style="visibility:hidden"> <apex:inputField value="{!object.date}"/> </apex:outputPanel>

 

All Answers

jwetzlerjwetzler

If you search around on the forums I think you'll find answers to a lot of your questions.

 

Here's the answer to this one 

NJDevilsFanNJDevilsFan
Thanks Jill, and thanks for the advice. I just tried the solution that this suggests, but the problem is that using the css to hide the field, as the other posting suggests, doesn't allow me to hide the little date thing that appears next to the input field. So if i implement it as suggested I just have a random date floating on my page. Any suggestions on what to do about that?
jwetzlerjwetzler

<apex:outputPanel style="visibility:hidden"> <apex:inputField value="{!object.date}"/> </apex:outputPanel>

 

This was selected as the best answer
NJDevilsFanNJDevilsFan
Works !!! Thanks again Jill.