cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tkantor
Frequent Visitor

Focusing input one after another gets blurred because of onChange action

Hello!

 

I have a PowerApps application page where I have multiple input controls one after another with some onChange" code and when you exit(blur) the first control by clicking on the next one, the cursor only stays there for a moment, then it blurs, you have to click the input again in order to be able to enter text.  (same thing if you want to proceed with 'Tab').
 
The onChange code has some UpdateContext on it, setting its value to a variable. I need it because the inputs are in a gallery placed as rows and I need to update the properties of the element in the row, and for some values other properties are recalculated as well.
 
Did anyone encounter this behavior? Any suggestions?
6 REPLIES 6
v-bofeng-msft
Community Support
Community Support

Hi @tkantor :

I'v made a test but did not encounted the problem you mentioned.

t17.gif

I suggest you change the device and test again.

If the problem can not be solved, could you tell me more details about the app? For example:

  • What exactly are these input controls?
  • What are these input controls' OnSelect attribute? (Specific code)
  • Are these controls in a gallery?What are the specific settings?

Best Regards,

Bof

Having inputs: txtVal1, txtVal2, txtResult. Each has the 'default' set to the backing property from the colGallery element: value1, value2 and result

Here is the onChange code for input txtVal1:

UpdateIf(colGallery, uniqId = ThisItem.uniqId, {value1: If(!IsBlank(txtVal1.Text), Value(txtVal1.Text, "fr-FR"), Blank())});
If(
    !IsBlank(ThisItem.value1) && !IsBlank(ThisItem.value2),
    UpdateIf(
        colGallery,
        uniqId = ThisItem.uniqId,
        { result: value1 * value2}
    ),
    UpdateIf(
        colGallery,
        uniqId = ThisItem.uniqId,
        { result: Blank()}
    )
);

Also I have input field outside the gallery with some onChange code that affects the colGallery and the same happens when I move focus from that input to one inside the gallery. Moving focus from gallery input to the one outside the gallery works fine - not blurred.

 

Seems that the problem is that I alter the colGallery, and reloading the displayed values blurs the inputs

Hi @tkantor :

I did the test according to your description and still did not reproduce the problem you mentioned.(The data source I use here is a collection)

t18.gif

Best Regards,

Bof

In my page the layout is like this:

tkantor_0-1594802593067.png

You see the same fields are edited and calculated here, and after clicking and typing in Value1 you should click on input Value2 directly, not outside anywhere in the screen and then on the next input as you do in your example.

Hi @tkantor :

Did you get blurred when you plan to edit the value2 of this item after editing the value1?
My guess is the delay caused by the change in the data source.
To verify this problem, I suggest that you can delete the OnChange proerty of these controls. Instead, add a button in the gallery to submit the update uniformly.

Best Regards,

Bof

Hi Bof, Thanks for the responsiveness.

Yes, exactly it gets blurred when I plan to edit the value2 of this item after editing the value1.

Clearly this does not occur if I remove the onChange code, also if I click and don't edit txtVal1 and then click on txtVal2 it stays focused.

I'm sorry to hear there is no other solution, it was request to easily go through fields with the use of Tab key and edit each field in this way.

All the best, Timea

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,608)