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
Raghu Sharma 6Raghu Sharma 6 

Equivalent of apex:inputHidden in lightning?

a. What is the equivalent of apex:inputHidden in lightning components?

b. I'm planning to implement TypeAhead/Predictive search to show the results from database/api calls. Any inputs/sample code on the approach to be followed?

 
Nayana KNayana K
a. There is no equivalent of apex:inputHidden in lightning. I don't think we need that. Because, if we take an aura:attribute with not showing it in UI + set the value based on our logic (just like how you set inputHidden value), this indirectly works like inputHidden. I am not sure whether I am making sense here, but I strongly feel we don't need any inputHidden equivalent.

b. 
I had created one unmanaged package:
https://login.salesforce.com/packaging/installPackage.apexp?p0=04t7F000001Awy1 
install this and check the relevant part.

You can check few links below:
https://meltedwires.com/2015/10/27/salesforce-lightning-lookup-component/
https://bitbucket.org/nlearner/lookup-lightning-component-slds.git

 
Raghu Sharma 6Raghu Sharma 6
Thanks Nayana for your inputs.

I have verified your component. My situation is slightly different. To make it easier to understand, lets use your example.
Assume you need a launch this lookup component from tab. After tab is launched, we should be able to search any contacts. So, when user types in 'Contact1', lookup should show all avaible contacts whose name starts with 'Contact1'. Based on the options shown, user can select a value and then he will click on a button which will perform some action using the contact information based on the contact chosen. In this situation, as we are only showing contact name in lookup but when user clicks on button, we will need additional contact info which is not shown on screen. How to achieve this scenario?
Nayana KNayana K
Check look-up (click on  open item focused radio button)  in 
https://www.lightningdesignsystem.com/components/lookups/

You just have tweek UI and change the logic to fetch extra info.