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
HobbeleHobbele 

Make outputPanel visible or invisible

Hello everybody,

i get started with visualforce before 2 days and im very interested in it.

I tried to made a area (For Example a outputPanel with inputfields) onClick visible and invisible.

I tried it by using AJAX in a Page, but it doesnt work. Have anybody an idea?

Thank you for every answer!
mtbclimbermtbclimber
Try the "rendered" attribute.
HobbeleHobbele
Hello mtbclimber,

thank you for your help.

After i cleared my problem, i got a new.

I can show and hide a outputText with the "rendered" Attribute, but if i want to show and hide a inputField, it doesnt work!

For better understanding i post you the section in my script.

Code:
<apex:pageBlockSection title="Advanced Account Information">
<apex:panelGrid columns="2">
<apex:outputPanel>
<apex:actionSupport event="onclick" rerender="detailAcc">
<apex:param name="statusAcc" value="false"></apex:param>
</apex:actionSupport>
<apex:outputText value="hide"></apex:outputText>
</apex:outputPanel>
<apex:outputPanel>
<apex:actionSupport event="onclick" rerender="detailAcc">
<apex:param name="statusAcc" value="true"></apex:param>
</apex:actionSupport>
<apex:outputText value="show"></apex:outputText>
</apex:outputPanel>
</apex:panelGrid>
<apex:outputPanel id="detailAcc">
<apex:actionStatus startText="Loading...">
<apex:facet name="stop">
<apex:inputField value="{!account.name}" rendered="{!$CurrentPageReference.parameters.statusAcc}"></apex:inputField>
</apex:facet>
</apex:actionStatus>
</apex:outputPanel>
</apex:pageBlockSection>

 Sorry for my very bad english

HobbeleHobbele
Ah, i have found a way to show and hide inputFields:

Code:
<apex:pageBlockSection title="Account Information">
<apex:panelGrid columns="2">
<apex:outputLabel value="Account Name" for="accountName"></apex:outputLabel>
<apex:inputField value="{!account.name}" id="accountName"></apex:inputField>
<apex:outputLabel value="Account Site" for="accountSite"></apex:outputLabel>
<apex:inputField value="{!account.site}" id="accountSite"></apex:inputField>
</apex:panelGrid>
<apex:panelGrid columns="2">
<apex:outputPanel>
<apex:actionSupport event="onclick" rerender="detailAcc">
<apex:param name="statusAcc" value="false"></apex:param>
</apex:actionSupport>
<apex:outputText value="hide"></apex:outputText>
</apex:outputPanel>
<apex:outputPanel>
<apex:actionSupport event="onclick" rerender="detailAcc">
<apex:param name="statusAcc" value="true"></apex:param>
</apex:actionSupport>
<apex:outputText value="show"></apex:outputText>
</apex:outputPanel>
</apex:panelGrid>
</apex:pageBlockSection>
<apex:outputPanel id="detailAcc">
<apex:actionStatus startText="Loading...">
<apex:facet name="stop">
<apex:pageBlockSection title="Advanced Account Information" rendered="{!$currentPageReference.parameters.statusAcc}">
<apex:panelGrid columns="2">
<apex:outputLabel value="Account BillingCity" for="accountBillingCity"></apex:outputLabel>
<apex:inputField value="{!account.BillingCity}" id="accountBillingCity"></apex:inputField>
<apex:outputLabel value="Account BillingPostalCode" for="accountBillingPostalCode"></apex:outputLabel>
<apex:inputField value="{!account.BillingPostalCode}" id="accountBillingPostalCode"></apex:inputField>
<apex:outputLabel value="Account BillingState" for="accountBillingState"></apex:outputLabel>
<apex:inputField value="{!account.BillingState}" id="accountBillingState"></apex:inputField>
<apex:outputLabel value="Account BillingCountry" for="accountBillingCountry"></apex:outputLabel>
<apex:inputField value="{!account.BillingCountry}" id="accountBillingCountry"></apex:inputField>
</apex:panelGrid>
</apex:pageBlockSection>
</apex:facet>
</apex:actionStatus>
</apex:outputPanel>

Here i show and hide a PageBlockSection with inputFields. That works fine.

Ok, then my hopeful last question in this topic:

Did anyone has the code for the same situation like my code above, but with only one link for show and hide ?!
 

The values of the inputFields in the "hide and show" PageBlockSection are not stored. Can anybody help ?

Message Edited by Hobbele on 10-18-2007 06:51 AM