[SalesForce] Controller fields not updated when actionSupport onchange event used

I have 3 fields Client, BilltoClient and project. Client is a lookup and billtoclient and project are dropdown. The project filed should get populated on the bases of client name and the billtoclint. I am using apex:actionsupport for the process my code `

<apex:pageblocksectionitem helpText="{!$ObjectType.Expense__c.Fields.Client__c.inlineHelpText}" id="clintBillname" >
 <apex:outputlabel value="Client Name: " /> 
 <apex:actionregion>
     <apex:inputField value="{!exp.Client__c}" />  
 </apex:actionregion>  
</apex:pageblocksectionitem>


<apex:pageblocksectionitem helpText="{!$ObjectType.Expense__c.Fields.Client_billable__c.inlineHelpText}" id="clintBillId" >
 <apex:outputlabel value="Bill To Client: " /> 
 <apex:actionregion >
 <apex:inputField value="{!exp.Client_billable__c}" id="billToC" >  
     <apex:actionsupport event="onchange" action="{!billToClint}" reRender="projectpanel" />
 </apex:inputField>   
 </apex:actionregion>  
 </apex:pageblocksectionitem>`

When i use 2 different apex:actionregion the i was getting null value for Client__c. So i changed and put both apex:pageblocksectionitem into 1 apex:actionregion. My code :

<apex:actionregion >
<apex:pageblocksectionitem helpText="{!$ObjectType.Expense__c.Fields.Client__c.inlineHelpText}" id="clintBillname" >
 <apex:outputlabel value="Client Name: " /> 
 <!--<apex:actionregion>-->
     <apex:inputField value="{!exp.Client__c}" />  
 <!--</apex:actionregion>  -->   
 </apex:pageblocksectionitem>


 <apex:pageblocksectionitem helpText="{!$ObjectType.Expense__c.Fields.Client_billable__c.inlineHelpText}" id="clintBillId" >
 <apex:outputlabel value="Bill To Client: " /> 
 <!--<apex:actionregion >-->
 <apex:inputField value="{!exp.Client_billable__c}" id="billToC" >  
     <apex:actionsupport event="onchange" action="{!billToClint}" reRender="projectpanel" />
 </apex:inputField>   
 <!--</apex:actionregion>  --> 
 </apex:pageblocksectionitem>
 </apex:actionregion>

Now i am getting the value of the clint__c field. But the formatting is getting changed.
enter image description here
What should i need to do for getting the formatting properly?

Best Answer

Once you fill the client name in browser it is still null in server. once you fill billto the billto value is submitted and the client name to is getting rerendered. Once you put some value in client name field make a dummy call to server to reflect it to server. Then on billto change happens the updated value will be reflected to client name and billto fileds along with project field update.

<apex:actionregion >
<apex:pageblocksectionitem helpText="{!$ObjectType.Expense__c.Fields.Client__c.inlineHelpText}" id="clintBillname" >
 <apex:outputlabel value="Client Name: " /> 
 <!--<apex:actionregion>-->
     <apex:inputField value="{!exp.Client__c}" >  
        <apex:actionsupport event="onchange" action="{!DUMMYCALL}" />
    </apex:inputField>
 <!--</apex:actionregion>  -->   
 </apex:pageblocksectionitem>


 <apex:pageblocksectionitem helpText="{!$ObjectType.Expense__c.Fields.Client_billable__c.inlineHelpText}" id="clintBillId" >
 <apex:outputlabel value="Bill To Client: " /> 
 <!--<apex:actionregion >-->
 <apex:inputField value="{!exp.Client_billable__c}" id="billToC" >  
     <apex:actionsupport event="onchange" action="{!billToClint}" reRender="projectpanel" />
 </apex:inputField>   
 <!--</apex:actionregion>  --> 
 </apex:pageblocksectionitem>
 </apex:actionregion>