I've overridden the new Opportunity page and I have a dynamically generated picklist of Contact Names and a static value "New Contact". When "New Contact" is selected a new panel is displayed with input fields (required) to create a new Contact. The rerendering of the Contact panel works fine.
My issue is if this value is selected by accident and the user means to pick another value the page won't allow them to due to the required fields in the newly displayed Contact panel. Is it possible to unrender (!) the panel on going from "New Contact" to "Another Value"?
Select List:
<apex:selectList value="{!SelectedCon}" size="1" label="Select Contact">
<apex:selectOptions value="{!con}"/>
<apex:actionSupport event="onchange" reRender="conContainer,debugContainer"/>
</apex:selectList>
Dynamic Panel:
<apex:outputPanel id="conContainer">
<apex:outputPanel id="con" rendered="{!If(SelectedCon='New Contact',true,false)}">
<apex:pageBlockSection title="New Contact Information" collapsible="false">
<apex:inputField value="{!constring.FirstName}" required="true"/>
<apex:inputField value="{!constring.LastName}" required="true"/>
<apex:inputField value="{!constring.Email}" required="true"/>
<apex:inputField value="{!constring.Title}" required="true"/>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:outputPanel>
{!SelectedCon='New Contact'}
returns true or false. There's no reason for an IF here (it bloats the view state size and slows rendering).