
Announcements
In Power Apps, how can I make a text input control execute an action, such as a search, only when the user has finished typing and the control loses focus?
I've already selected "FocusOut" for the text input control's TriggerOutput property. According to Microsoft's description, TriggerOutput has three options:
FocusOut: Triggers OnChange only when the text input control loses focus. This is the default option.
Delayed: Triggers OnChange after a half-second delay. Useful for delaying expensive operations until the user completes inputting text.
Keypress: Triggers OnChange immediately as the user types.
Based on my understanding, "FocusOut" should be the behavior I want. However, even after selecting "FocusOut," the search is still being executed with every character typed (similar to the "Keypress" behavior), which significantly impacts performance.
Consider the following example: there is a text input control (name: inputEmail) and a label(name: resultName) control. After I input a user's email address into the text input, the label displays the user's name.
Here's my setting.
resultName.text = Office365Users.UserProfileV2(inputEmail.Value).displayName
The problem is that every time I type a letter into the text box, it throws the following error saying it can't be found (that's because I haven't input the whole email address yet.), until I finish typing the correct email address.
Office365Users.UserProfileV2 fail: { "error": { "code": "ResourceNotFound", "message": "User not found", "innerError": xxxxxxxx} }
And the following setting also result the same issue: Set OnChange property of inputEmail as
UpdateContext({v_resultName:Office365Users.UserProfileV2(inputEmail.Value).displayName})
Then set the Text property of Label
resultName.Text = v_resultName
How can I make it so that the search only starts when I finish typing the entire address / move my focus away from the text box? thanks.