function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ExploreForceExploreForce 

Populate LOOKUP field based on picklist/<apex:selectionlist>: Pls help

I have a scenario where, I want to populate LOOKUP field based on <apex:selectionlist>

Example:
<apex:outputLabel for="attribute-search-status" value="Categories"/>
            <apex:outputPanel styleClass="requiredInput" layout="block" >
             <apex:outputPanel styleClass="requiredBlock" layout="block"/>
                  <apex:selectList id="theform" value="{!selectedCategory}" size="1" required="true" style="width:180px" >
                <apex:selectOptions value="{!Categories}" />
                <!--<apex:actionSupport event="onchange" action="{!createServiceAgreement}" reRender="pg"/>-->
                <!--<apex:actionFunction name="createServiceAgreement" action="{!createServiceAgreement}" reRender="panel"/>
                <apex:actionSupport event="onchange"/>-->
              </apex:selectList>        
              </apex:outputPanel>

And my lookup field is :

<apex:inputField id="panel" value="{!ReqUser.ServiceAgreement__c}" required="true"/>


I tried couple of solutions using:

<apex:actionFunction name="createServiceAgreement" action="{!createServiceAgreement}" reRender="panel"/>
and there is no solution.


1..Is that really possible to populate LOOKUP field based on selectionlist using <APEX:ACTIONFUNCTION>???
or 2.Have to only Trigger in such scenario??

Pls help. 
pankaj kabra 8pankaj kabra 8
put the input field in some panel.

like

<apex:outputPanel id="panel">

<apex:inputField value="{!ReqUser.ServiceAgreement__c}" required="true"/>

</apex:outputpanel>

and now try to rerender panel using action function.