5

I am using apex:selectList..I want to get the value on onchange of the selectlist..But for first time when i am debugging the value..Its blank..ID comes when i change it again(Second time)..But its the previous value..If i change it again..It again shows the previous value,not the new value and so on.. So it gives me the old value.?`

Please help Its urgent

{!hr.p} The value get refreshed on the VF page but not in the controler

Updated

    <apex:pageBlockTable value="{!wrapperTimeCardList}" var="hr" id="thePbTable">
       <apex:column >
        <apex:selectList value="{!hr.p}" size="1" multiselect="false" onchange="proIp('{!hr.pp}');">

                              <apex:actionSupport event="onchange" action="{!taks}" reRender="thePb">
                                   <apex:param name="prId"  value="{!hr.p}"  assignTo="{!proIdVal}" ></apex:param>
                               </apex:actionSupport>
                               Project: <apex:selectOptions value="{!hr.projectListOptions}"/>
                          </apex:selectList>`
    </apex:column >
    </apex:pageBlockTable>

    public void fp()
        {

             **value is blank here for First time,then old value always.???**


        }


**Wrapper Class**

    public List<wrapperliass> wrappeList{get;set;}
        public class wlass{
            public List<Selectoption> prOptions{get;set;}
            public List<Selectoption> pListOptions{get;set;}
            public String pVal{get;set;}
            public String prskVal{get;set;}

            Public blob fileData{get;set;}


            public wrapperTimeCardClass(List<Selectoption> Options,List<Selectoption> ptions,
                                                               ){
                this.prptions=tOptions;
                this.proOptions=projectTaions; 
                this.projVal='';                                   

            }

        }
4

It's because your reference twice hr.projectVal, that's why it's getting confused, one in your select and one in your param. Remove your param and it should fix your problem, it's useless.

Update

Project: <apex:selectList value="{!hr.projectVal}" size="1" multiselect="false">
                      <apex:actionSupport event="onchange" action="{!fillProjectTasks}" reRender="thePb"/>
                        <apex:selectOptions value="{!hr.projectListOptions}"/>
                  </apex:selectList>


public void fillProjectTasks()
{
proIdVal = hr.projectVal; 
System.debug('============proIdVal======'+proIdVal);
     **value is blank here for First time,then old value always.???**


}
9
  • Yeah of course you need to assign in your controller – Cloud Ninja Jun 26 '15 at 10:45
  • prodIdVal = hr.projectVal in fillProjectVal – Cloud Ninja Jun 26 '15 at 10:49
  • I only want to get the changed select list value..Can you help me ...How do i get that,?As its a list.??How to get which one user has changed.? – miku Jun 26 '15 at 10:49
  • I updated my answer for you – Cloud Ninja Jun 26 '15 at 10:56
  • Hey brovasi... wrapperTimeCardList is a wrapper list and projectVal is the variable of that wrapper class...If i do like this proIdVal = hr.projectVal; If my wrapperlist has 2 records...always last value will come..not the changed one..?You got my issue. – miku Jun 26 '15 at 11:01

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.