You need to sign in to do that
Don't have an account?
mac admin
Clear the values in the custom picklist dependent fields
Hi everyone,
In my custom vf page i have create a picklist with 3 different values,when a value is selected from picklist then related dependent fields are showing. some fields are comman for picklist values. I want to clear the values in those common fields when picklist value is changed.
Can anyone help me over here.
Regards,
mac.
In my custom vf page i have create a picklist with 3 different values,when a value is selected from picklist then related dependent fields are showing. some fields are comman for picklist values. I want to clear the values in those common fields when picklist value is changed.
Can anyone help me over here.
Regards,
mac.
Something like below :
Do remember to create the proper hierarchy of Id's in your VF page to reach your component.
Eg..
All Answers
When you are changing the picklist value then initialize the object that you have created.
Ex:- Account Acc = new Account();
<apex:page standardController="IntakeGraduation__c">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Submit" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="About You" columns="2">
<apex:inputField value="{!IntakeGraduation__c.name}"/>
<apex:inputField value="{!IntakeGraduation__c.Middle_Name__c}"/>
<apex:inputField value="{!IntakeGraduation__c.Last_Name__c}"/>
<apex:inputField value="{!IntakeGraduation__c.Gender__c}"/>
<apex:inputField value="{!IntakeGraduation__c.Date_of_Birth__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Parents Information" columns="1">
<apex:outputLabel value="With whom may we share your information"/>
<apex:actionRegion >
<apex:inputField value="{!IntakeGraduation__c.With_whom_may_we_share_your_information__c}">
<apex:actionSupport event="onchange" reRender="ajaxrequest" />
</apex:inputField>
</apex:actionRegion>
<apex:outputPanel id="ajaxrequest">
<apex:pageBlockSection rendered="{!IntakeGraduation__c.Select_program__c =='MFA'}" columns="1">
<apex:inputField value="{!IntakeGraduation__c.Select_one_if_mfa__c}"/>
<apex:inputField value="{!IntakeGraduation__c.Graduation_Date__c}"/>
</apex:outputLabel>
<apex:outputLabel value="Are you or have you been enrolled in more than one college for college credit? "/>
<apex:actionRegion >
<apex:inputField value="{!IntakeGraduation__c.enrolled_in_more_than_one_college__c}">
<apex:actionSupport event="onchange" reRender="ajaxrequest" />
</apex:inputField>
</apex:actionRegion>
<apex:outputPanel id="ajaxrequest">
<apex:pageBlockSection rendered="{!IntakeGraduation__c.enrolled_in_more_than_one_college__c=='Yes'}" columns="1">
<apex:PageBlockSectionItem >
<apex:outputLabel value="Number of colleges attended Previously"/>
<apex:actionRegion >
<apex:inputField value="{!IntakeGraduation__c.Number_of_colleges_attended__c}" required="true">
<apex:actionSupport event="onchange" reRender="ajaxrequest1" />
</apex:inputField>
</apex:actionRegion>
</apex:PageBlockSectionItem>
<apex:outputPanel id="ajaxrequest1">
<apex:pageBlockSection rendered="{!IntakeGraduation__c.Number_of_colleges_attended__c=='1'}" columns="1">
<apex:inputField value="{!IntakeGraduation__c.Last_College_University_Attended__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Information_City_one__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Information_State_one__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Info_Type_of_enrollment_one__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection rendered="{!IntakeGraduation__c.Number_of_colleges_attended__c=='2'}" columns="1">
<apex:inputField value="{!IntakeGraduation__c.Last_College_University_Attended__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Information_City_one__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Information_State_one__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Info_Type_of_enrollment_one__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_University_Attended_two__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Information_City_two__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Information_State_two__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Info_Type_of_enrollment_two__c}"/>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection rendered="{!IntakeGraduation__c.Enrollment_Classification__c=='Transfer'}" >
<apex:inputField value="{!IntakeGraduation__c.Full_name_of_last_college_attended__c}"/>
<apex:inputField value="{!IntakeGraduation__c.Graduation_or_Withdrawal_Date__c}"/>
<apex:inputField value="{!IntakeGraduation__c.Have_you_previously_applied_to_MCA__c}"/>
<apex:outputLabel value="Were you previously enrolled for credit at our school?">
<apex:inputField value="{!IntakeGraduation__c.enrolled_for_credit_at_our_school__c}"/>
</apex:outputLabel>
<apex:PageBlockSectionItem >
<apex:outputLabel value="Number of colleges attended Previously"/>
<apex:actionRegion >
<apex:inputField value="{!IntakeGraduation__c.TrNumber_of_colleges_attended_Previously__c}" required="true">
<apex:actionSupport event="onchange" reRender="ajaxrequest1" />
</apex:inputField>
</apex:actionRegion>
</apex:PageBlockSectionItem>
<apex:outputPanel id="ajaxrequest1">
<apex:pageBlockSection rendered="{!IntakeGraduation__c.Number_of_colleges_attended__c=='1'}" columns="1">
<apex:inputField value="{!IntakeGraduation__c.Last_College_University_Attended__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Information_City_one__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Information_State_one__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Info_Type_of_enrollment_one__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection rendered="{!IntakeGraduation__c.Number_of_colleges_attended__c=='2'}" columns="1">
<apex:inputField value="{!IntakeGraduation__c.Last_College_University_Attended__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Information_City_one__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Information_State_one__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Info_Type_of_enrollment_one__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_University_Attended_two__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Information_City_two__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Information_State_two__c}"/>
<apex:inputField value="{!IntakeGraduation__c.College_Info_Type_of_enrollment_two__c}"/>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection rendered="{!IntakeGraduation__c.Enrollment_Classification__c=='Re-enroll'}" columns="1">
<apex:inputField value="{!IntakeGraduation__c.Last_date_enrolled_at_MCA__c}"/>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Something like below :
Do remember to create the proper hierarchy of Id's in your VF page to reach your component.
Eg..