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
Ayan HoreAyan Hore 

Lookup inputfield in Visualforce with multiple item match

Hi,
I have a visualforce page with a user inputfield (lookup) and is bind to an object at the controller. Whenever there are multiple matches to my search text, the first item in the list is always selected. So, when I hit save, the selected value is not passed to the controller. In the VF page, I've used action support with onchange and onselect events, but since I'm not making any change (the first value in the list is selected) so those events are not getting fired. Is there any way to resolve that?

My Code:
<apex:inputField value="{!currentObject.OwnerId}" id="OwnerChangeField">
     <apex:actionSupport event="onchange" reRender="refresh"/> 
     <apex:actionSupport event="onselect" reRender="refresh"/>
</apex:inputField>


User-added image
This is what I'm getting in the UI and the current selection is the correct one, but still the value does not reach the controller due to those events not firing.

I'm unable to get the default selected value in the controller. I might be missing something or there might be a better way to do this. Any help will be appreciated!

Regards,
Ayan
Marek Kosar_Marek Kosar_
Hi Ayan,

paste here your controller method please, I'll be much easier to help you.

Marek