0

Hoping someone can help with the below code :

This issue im having is that when it triggers validation and prevents render from running unless all required fields have been filled in.

<apex:form >
    <apex:pageBlock title="Costing Enquiry Form Edit" mode="maindetail" id="pb">
         <apex:pageBlockButtons location="bottom">
            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
         </apex:pageBlockButtons>

        <apex:pageBlockSection title="Information" columns="2">
            <apex:inputField value="{!Costing_Enquiry_Form__c.Customer_Name__c}" required="false"/>
            <apex:inputField value="{!Costing_Enquiry_Form__c.OwnerId}" required="false"/>
            <apex:inputField value="{!Costing_Enquiry_Form__c.Contact_Name__c}" required="false"/>


             <apex:inputField value="{!Costing_Enquiry_Form__c.Product_Type__c}" required="true">
                 <apex:actionSupport event="onchange" reRender="conditional"/>
                 <!-- triggers validation and prevents rerender from running unless all required fields have been filled in. -->
             </apex:inputField>



            <apex:inputField value="{!Costing_Enquiry_Form__c.End_User__c}" required="false"/>
            <apex:inputField value="{!Costing_Enquiry_Form__c.Target_Selling_Price__c}" required="true"/>
            <apex:inputField value="{!Costing_Enquiry_Form__c.Status__c}" required="true"/>
            <apex:inputField value="{!Costing_Enquiry_Form__c.Estimated_Quantity__c}" required="true"/>
            <apex:inputField value="{!Costing_Enquiry_Form__c.Quote_Number__c}" required="false"/>
            <apex:inputField value="{!Costing_Enquiry_Form__c.Sample_Required__c}" required="false"/>

            <apex:inputField value="{!Costing_Enquiry_Form__c.Customer_is_currently_using_Seen__c}" required="true"/>

            <apex:pageBlockSection id="conditional">
                <apex:inputField value="{!Costing_Enquiry_Form__c.ChemCre8_Code__c}" rendered="{!IF(Costing_Enquiry_Form__c.Product_Type__c =='Chemcre8',TRUE,FALSE)}" required="true"/>
                <apex:inputField value="{!Costing_Enquiry_Form__c.Bespoke_Garment_Additional_Information__c}"  rendered="{!IF(Costing_Enquiry_Form__c.Product_Type__c =='Bespoke Garment',TRUE,FALSE)}" required="true"/>
            </apex:pageBlockSection>

            <apex:inputField value="{!Costing_Enquiry_Form__c.Required_Standards_CE_Markings__c}" required="true"/>
            <apex:pageBlockSectionItem />
            <apex:inputField value="{!Costing_Enquiry_Form__c.Special_Requirements_Comments__c}" required="true"/>
            <apex:pageBlockSectionItem />
            <apex:inputField value="{!Costing_Enquiry_Form__c.Send_to__c}" required="true"/>
        </apex:pageBlockSection>            

    </apex:pageBlock>
</apex:form>

<apex:relatedList list="OpenActivities" />
<apex:relatedList list="ActivityHistories" />
<apex:relatedList list="CombinedAttachments" />

0
1

I believe that you just need to use the <apex:actionRegion>

it would be something like

<apex:actionRegion>
    <apex:inputField value="{!Costing_Enquiry_Form__c.Product_Type__c}" required="true">
        <apex:actionSupport event="onchange" reRender="conditional"/>
    </apex:inputField>
</apex:actionRegion>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.