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
Gleb GawriljukGleb Gawriljuk 

Lightning:recordEditForm - prefilling a lookup leads to the field being focused in the frontend

Hey everyone,

we are building a Lightning Component with the user of the lightning:recordEditForm  to create a record.
 
<lightning:recordEditForm aura:id="input_placementRecordEditForm" 
                                      recordTypeId="{!v.placementRecordTypeId}" 
                                      objectApiName="cxsrec__Placement__c"
                                      onsubmit="{!c.handleSubmit}" 
                                      onsuccess="{!c.handleSuccess}" 
                                      onload="{!c.handleLoad}"
                                      onerror="{!c.handleError}">
<lightning:inputField aura:id="gulp_Sales_Consultant__c" fieldName="gulp_Sales_Consultant__c" value="{!v.placement.gulp_Sales_Consultant__c}"/>


Within this form with have a lookup that we are prefilling in the handleLoa()d method/event:
//component.set("v.placement.gulp_Sales_Consultant__c",  component.get("v.position").cxsrec__Sales_consultant__c);
                   component.find("gulp_Sales_Consultant__c")[0].set("v.value", component.get("v.position").cxsrec__Sales_consultant__c);
However, after the handleLoad() method is run and the field is successfully prefilled, the compontent scrolls down to the fields and the field and the field is focused (highlighted with a blue border).

AM I doing the prefilling of the lookup wrong or how can I stop the component from focusing on the field after it is set by the controller?

Regards,
Gleb