• hemanth Tanguturi 14
  • 0 Points
  • Member since 2016

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 0

I have created a visual force page 2 fields class and fee. when ever the class is selected or changed from picklist--the fee field should be refreshed based on the amount value we soql from fees__c object.
used action support with params with on change event of class picklist
Problem: the render is happening on first change of picklist only???
the fee field is not displayed on changing the picklist field???

Here is the code:

VF Page:
<apex:page standardController="Student_Reg__c" extensions="stuExt1">
<apex:form >
<apex:pagemessages ></apex:pagemessages>
<apex:pageblock >
<apex:pageblocksection title="Student Details" >
<apex:inputText value="{!Student_Reg__c.First_Name__c}"/>
<apex:inputField value="{!Student_Reg__c.Last_Name__c}"/>
<apex:inputField value="{!Student_Reg__c.Date_Of_Birth__c}"/>
<apex:inputField value="{!Student_Reg__c.Class__c}">
<apex:actionsupport rerender="fee_info" event="onchange" action="{!changeFee}">
<apex:param name="cid" value="{!Student_Reg__c.Class__c}"/>
<apex:pageBlockSection title="Fee Details" id="fee_info">
<apex:inputField value="{!fe.amount__c}"/>

public class stuExt1 {

    string classs=ApexPages.currentPage().getParameters().get('cid');
    public fees__c fe {get;set;}
    public stuExt1(ApexPages.StandardController stdController) {

    public void changeFee(){
    integer f=integer.valueof(classs);
    fees__c fe=[select branch__c,class__c,Amount__c from fees__c where class__c=:f limit 1];