[SalesForce] apex:selectList always passing older value on onchange..

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='';                                   

            }

        }

Best Answer

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.???**


}
Related Topic