You need to sign in to do that
Don't have an account?
Semira@gmail.com
actionsupport for lookup field not firing
Hi I'm trying to get a value of contact field when the contact is selected through a lookup. But for some reason it's rendering. I'm sure what am I missing or maybe actionsupport isn't the solution?
By the way the Unit is a custome object on where I'm using standard object and calling an extension Class
By the way the Unit is a custome object on where I'm using standard object and calling an extension Class
<apex:actionRegion immediate="true"> <apex:pageblockSection columns="1" title="Items"> <apex:outputPanel id="name"> <apex:pageBlockTable value="{!Item}" var="a" columns="3"> <apex:column headerValue="Materials" > <apex:inputfield value="{!a.Contact__c}"/> <apex:actionSupport event="onchange" action="{!getUnit}" rerender="name"/> </apex:column> <apex:column headerValue="Unit"> <apex:outputfield value="{!Unit.Contact__r.Lastname}"/> </apex:column> <apex:column headerValue="ship"> <apex:inputfield value="{!a.Job_Role__c}"/> </apex:column> </apex:pageBlockTable> </apex:outputPanel> <apex:pageBlockTable value="{!Item}" var="a" columns="3"> </apex:pageBlockTable> </apex:actionRegion> </apex:pageblockSection>
public with sharing class CreateMaterialItem { ApexPages.StandardController JC; Public Job_Contact__c Unit {get; set;} public CreateMaterialItem(ApexPages.StandardController controller) { Unit = [select id, contact__c, contact__r.lastname from Job_contact__c where job__c =: JC.getID() limit 1]; } public pageReference getUnit(){ for (Job_contact__c lst : [select id, contact__c, contact__r.lastname from Job_contact__c where job__c =: JC.getID() limit 10]) { Unit.contact__r.lastname = lst.contact__r.lastname; } return null; } . . . . }//end of classPlease please help! This is kind of urgent!
These are my findings,
1. Instance variable JC is never initialized. Rewrite your constructor,
2. You are using actionregion with immediate = true. Double check if you really want this.
3. Your business requirement is not very clear to me. Specially the getUnit method. It is very difficult to suggest anything else without understanding the requirement.
--Akram
All Answers
<apex:inputfield value="{!a.Contact__c}" >
<apex:actionSupport event="onchange" action="{!getUnit}" rerender="name"/>
</apex:inputField>
These are my findings,
1. Instance variable JC is never initialized. Rewrite your constructor,
2. You are using actionregion with immediate = true. Double check if you really want this.
3. Your business requirement is not very clear to me. Specially the getUnit method. It is very difficult to suggest anything else without understanding the requirement.
--Akram