DEV Community

Ramon Sanchez Belillas
Ramon Sanchez Belillas

Posted on

How to trigger tab (InputText) in Microsoft Power Apps

I've recently faced a couple of issues while developing with Power Apps, I haven't been able to find solutions to them on the internet (the closest workaround I've found is to add a timer with a timeEnd which seemed a bit odd to me) so I've developed my own solution, but let's explain the issues first:

Problem 1:

  1. In a formatted text field.
  2. you add a value (let's say 1000).
  3. The onChange event is triggered.
  4. The field is formatted to 1,000.00.
  5. The formatted value gets injected to the field.
  6. Edit the input field adding 1000 again.
  7. The onChange event doesn't trigger because it considers it "the same".

Problem 2:

  1. When you press tab in input field and go to another input field
  2. The onSelect is not activated because you have to "Click"

SOLUTION:

We need to create two text inputs and one button like that:

InputText 1:

  1. Create an input text (inputText1)
  2. onChange:
   Set(ChangeNumberVar;
       Text(
           Value(TextInput1.Text);"#,###.00";"ca-ES"
       )
   );;
   Select(Button1)
Enter fullscreen mode Exit fullscreen mode

(nextStep) 3. Default:

   ChangeNumberVar
Enter fullscreen mode Exit fullscreen mode

(nextStep) 4. tabIndex: 1

InputText 2:

  1. Create another input text (inputText2)
  2. tabIndex:3

Button1:

  1. Create a button (button1)
  2. tabIndex:2
  3. Visible: false
  4. onSelect:
   Reset(TextInput1);;
   SetFocus(TextInput2)
Enter fullscreen mode Exit fullscreen mode

Image at the end of creating the solution

Now you can switch from inputText1 to inputText2 by triggering the OnSelect trigger using the tab key.

Side Notes:

The main language on my environment is spanish. If the provided solution doesn't work for you, please leave a comment and we can take a look at your specific use-case 😁

Best regards!

Top comments (1)

Collapse
 
msvanred profile image
Markus

Thanks a lot for sharing.
Especially the missing "onselect" when using Tabs switchen between controls helped a lot!