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
mohit Srivastavamohit Srivastava 

how to retrieve the value from pict list which is of input field

hi guys ,

i have to implement a functionality in which i have to select a value in the picklist (inputfield), when i select the field then the  value  automatically got stored in object by calling a update method of controller , how to implement this .. 
Best Answer chosen by mohit Srivastava
Pramodh KumarPramodh Kumar

Use action function and call the javascript on your field. here is the small example


<apex:actionFunction action="{!accountUpdate}" name="updateAccount"  >
<apex:pageBlockTable value="{!accountList }" var="tl">
             <apex:column headerValue="T Rank">
                      <apex:inputField value="{!tl.T_Rank__c}" onchange="updateAccount()"/>
             </apex:column>
</apex:pageBlockTable> 


public void accountUpdate(){
        list<Account> accList = new list<Account>();      
        for(Account a : accountList ){             
            accList .add(ra);      
        }
        if(!accList .isEmpty()){
            update accList ;
        }
    }

Thanks,
Pramodh

All Answers

Pramodh KumarPramodh Kumar

Use action function and call the javascript on your field. here is the small example


<apex:actionFunction action="{!accountUpdate}" name="updateAccount"  >
<apex:pageBlockTable value="{!accountList }" var="tl">
             <apex:column headerValue="T Rank">
                      <apex:inputField value="{!tl.T_Rank__c}" onchange="updateAccount()"/>
             </apex:column>
</apex:pageBlockTable> 


public void accountUpdate(){
        list<Account> accList = new list<Account>();      
        for(Account a : accountList ){             
            accList .add(ra);      
        }
        if(!accList .isEmpty()){
            update accList ;
        }
    }

Thanks,
Pramodh
This was selected as the best answer
mohit Srivastavamohit Srivastava
hi can i use action support to ease the code ???