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
ankitha varraankitha varra 

Action support is not working in vf page

Vf page

<apex:inputField value="{!Accounts__c.Type_Of_Account__c}"  required="true">
<apex:actionsupport event="onchange" rerender="Guardian"/>
</apex:inputfield>
<apex:outputpanel id="Guardian" >
<apex:pageBlockSectionItem rendered="{!if(Accounts__c.Type_Of_Account__c='Minor',true,false)}" >
<apex:outputLabel >Guardian Name</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Guardian_Name__c}" />
</apex:pageBlockSectionItem>
</apex:outputpanel>

code is not working please help me
Vivek DVivek D
<apex:form>        
<apex:inputField value="{!Accounts__c.Type_Of_Account__c}"  required="true">
<apex:actionsupport event="onchange" rerender="Guardian"/>
</apex:inputfield>
<apex:outputpanel id="Guardian" >
<apex:pageBlock>
<apex:pageBlockSection rendered="{!if(Accounts__c.Type_Of_Account__c=='Minor',true,false)}" >
<apex:outputLabel >Guardian Name</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Type_Of_Account__c}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputpanel>
</apex:form>

 
ankitha varraankitha varra
Whats wrong with the code i have written pls help me
Vivek DVivek D
There is nothing wrong with your code as such but just to keep in mind for VF development. Form tag plays a very important role when you are using render, rerender and action items.
  1. All the input and select element basically all form elements should be under one form tag. You can use multiple forms if you want to have different inputs etc. In your example both the elements should be in same form
  2. Hierarchy for page elements like pageBlock , pageblocksection, pageblocksectionitem etc should be proper
ankitha varraankitha varra
<apex:page standardController="Accounts__c" extensions="YesBankAccount" showHeader="false" title="YES BANK">
<apex:composition template="YesBank_MenuBarTemplete">
</apex:composition>
<!--<apex:sectionHeader title="Account" subtitle="Home"/>-->
<style>
body .bPageBlock .pbBody .Orange .pbSubheader
{
background-color:#FF8C00;
}
body .bPageBlock .pbBody .OrangeRed .pbSubheader
{
background-color:#FF4500;
}
</style>
<apex:form >
<apex:pageBlock tabStyle="Account" title="New Account Form">
<apex:outputPanel styleClass="OrangeRed" layout="block">
<apex:pageBlockSection title="Account Information" collapsible="false" columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel >Type Of Account</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Type_Of_Account__c}"  required="true">
<apex:actionsupport event="onchange" rerender="Guardian"/>
</apex:inputfield>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Priority</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Priority__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Amount</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Amount__c}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:outputPanel>
    
<apex:outputPanel styleClass="OrangeRed" layout="block">
<apex:pageBlockSection title="Additional Services Required" collapsible="false" columns="2">
<apex:pageBlockSectionItem >
<apex:outputLabel >Internet Banking</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Internet_Banking__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Mobile Banking</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Mobile_Banking__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Debit-Cum-ATM Card</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Debit_Card__c }"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Insurance</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Need_Insurance__c}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:outputPanel>
  
<apex:outputPanel styleClass="Orange" layout="block">  
<apex:pageBlockSection title="Personal Information" collapsible="false" columns="2" >
<apex:pageBlockSectionItem >
<apex:outputLabel >Name</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Name__c}"  required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Father Name</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Father_Name__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Mother Name</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Mother_Name__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Joint Holder Name</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Joint_Holder_Name__c}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>

<apex:outputpanel id="Guardian" >
<apex:pageBlockSection rendered="{!if(Accounts__c.Type_Of_Account__c='Minor',true,false)}" >
<apex:outputLabel >Guardian Name</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Guardian_Name__c}" />
</apex:pageBlockSection>
</apex:outputpanel>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Date Of Birth</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Date_Of_Birth__c}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Age</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Age__c}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Mobile Number</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Mobile_Number__c}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Email</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Email__c}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Marital Status</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Marital_Status__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
<apex:outputpanel id="spouse">
<apex:pageBlockSectionItem >
<apex:outputLabel >Spourse Name</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Spouse_Name__c}" />
</apex:pageBlockSectionItem>
</apex:outputpanel>
</apex:pageBlockSection>
</apex:outputPanel>
 
<apex:outputPanel styleClass="OrangeRed" layout="block">
<apex:pageBlockSection title="Proofs Information" collapsible="false" columns="2">
<apex:pageBlockSectionItem >
<apex:outputLabel >Identity Proofs</apex:outputLabel>
<apex:inputField value="{!Accounts__c.ID_Proofs__c}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Aadhaar ID</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Aadhaar_ID__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Driving License No</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Driving_License_No__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >PAN Number</apex:outputLabel>
<apex:inputField value="{!Accounts__c.PAN_Number__c}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Passport Number</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Passport_Number__c}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Voter ID</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Voter_ID__c}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Address Proofs</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Address_Proofs__c}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:outputPanel>


<apex:outputPanel styleClass="Orange" layout="block">    
<apex:pageBlockSection title="Professional Information" collapsible="false" columns="2">
<apex:pageBlockSectionItem >
<apex:outputLabel >Educational Qualification</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Educational_Qualification__c}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Type of Employement</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Type_Of_Employement__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Salary</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Salary__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Type of Organisation</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Type_Of_Organisation__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Type of Institute</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Type_Of_Institute__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Organization Name</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Organization_Name__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Educational Institute Name</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Educational_Institute_Name__c }"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Turn Over Per Annum</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Turn_Over_per_Annum__c}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:outputPanel>

<apex:outputPanel styleClass="Orange" layout="block"> 
<apex:pageBlockSection title="Address Information" collapsible="false" columns="2">
<apex:pageBlockSectionItem >
<apex:outputLabel >Current Address</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Current_Address__c}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Permanent Address</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Permanent_Address__c}" required="true"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >State</apex:outputLabel>
<apex:inputField value="{!Accounts__c.State_Current__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >State</apex:outputLabel>
<apex:inputField value="{!Accounts__c.State_Permanent__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >City</apex:outputLabel>
<apex:inputField value="{!Accounts__c.City_Current__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >City</apex:outputLabel>
<apex:inputField value="{!Accounts__c.City_Permanent__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Pin Code</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Pin_Code_Current__c}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Pin Code</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Pin_Code_Permanent__c }"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel >Copy if Both are Same</apex:outputLabel>
<apex:inputField value="{!Accounts__c.Copy_if_both_are_Same__c  }"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:outputPanel>
    
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Submit"/>
<apex:commandButton value="Cancel"/>
</apex:pageBlockButtons>

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

this is my total code, whats wrong with this code