3

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?

1
  • AnuRaj -- looks like you got an answer to your original question so mark it as an answer and post your formatting question as a new question
    – cropredy
    Apr 24, 2014 at 21:23

1 Answer 1

1

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>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .