Power Apps Exchange

Please login or click SIGN UP FOR FREE to create your PowerAppsUG account to join this user group.
 View Only
Expand all | Collapse all

Forcing upper case letters in a datacard or text field entry

  • 1.  Forcing upper case letters in a datacard or text field entry

    Posted Jan 23, 2023 04:38 PM
    Hello,
    Trying to figure out how to force upper case letters in a datacard or text field entry.  I have a couple of datacards that I want to have forced to upper case on a form.  The user needs to be able to see the entries in all upper case before they submit the form.  A SubmitForm() is used to submit the form and write the data to the Azure SQL back end.

    I have another screen that the user can enter information into text boxes and I use the Upper() function in the Patch() to force the entry to upper case.  Though it would be nice to have the user be able to see the case of the data entry, all upper case, before they submit the form.

    Thanks in advance for your assistance.

    ------------------------------
    Kind regards,
    John Heck
    -----------------------
    ------------------------------


  • 2.  RE: Forcing upper case letters in a datacard or text field entry

    Bronze Contributor
    Posted Jan 24, 2023 03:03 PM
    Without trying to verify this, you might want to use the Upper() fuction in the OnChange or even the OnSelelct prooperty of othe field in the datacard to show the user the changed value.

    OTOH, I am often surprised at how something seemingly obvious iin approach fails in practice

    ------------------------------
    Larry Heimendinger
    larry@techevents.com
    EverettWA
    ------------------------------



  • 3.  RE: Forcing upper case letters in a datacard or text field entry

    Posted Jan 25, 2023 11:17 AM
    Edited by Ed Bellman Jan 27, 2023 07:39 AM
    This isn't a perfect or elegant solution [EDIT - see Warren's below], but it works -

    Insert a Label (Label11 in screenshots) and Text Input field (TextInput1). Arrange them so that the X,Y values are the same in the canvas and in the Tree view on the left, make sure the Text Input field is above the Label so that it will receive the focus from the tab or mouse selection.


    Set the following properties:
    • TextInput1
      • Color - transparent (use the picker or just set the A value of RGBA to 0)
      • Fill Color - transparent
      • Hover Color - transparent
      • Hover Fill - transparent
      • Maybe Pressed and Focus colors as well?
    • Label11
      • Text = Upper(TextInput1.Text)
      • X = TextInput1.X
      • Y = TextInput1.Y
      • Width = TextInput1.Width

    Test in play mode

    Edit mode, after test, with fields un-stacked and TextInput1 Color set back to Black.

    Downside - you can't see the cursor in the TextInput field since it is transparent, but if you select and just start typing it works.

    Hopefully this helps or sparks other ideas.
    Ed


    ------------------------------
    Ed Bellman
    Principal Consultant - Power Apps
    ------------------------------



  • 4.  RE: Forcing upper case letters in a datacard or text field entry
    Best Answer

    Top Contributor
    Posted Jan 26, 2023 01:54 AM
    Hi @John Heck,
    If it is OK for them to see lower case while entering, but have it switch and save to upper case, then ​OnChange of the Text Box
    UpdateContext({varUpper: Upper(Self.Text)});
    Reset(Self)​

    Default (assuming you want to also display existing values if they are present and not change them)

    Coalesce(varUpper, Parent.Default)

    DelayOutput

    true

    OnSuccess of Form and screen OnVisible

    UpdateContext({varUpper: Blank()})
    ​See below
    changes to upper case


    ------------------------------
    Warren Belz
    MVP (Business Applications)
    Australia
    ------------------------------



  • 5.  RE: Forcing upper case letters in a datacard or text field entry

    Posted Feb 06, 2023 02:23 PM
    Hello @Warren Belz, thanks for the solution.  It works great.  Sorry it took me so long to test it and get back with you.  Really appreciate the help.​

    ------------------------------
    John Heck
    ------------------------------



  • 6.  RE: Forcing upper case letters in a datacard or text field entry

    Posted Feb 06, 2023 02:25 PM
    Hello @Ed Bellman, your solution worked as well though the users didn't like not being able to see the cursor to know which field they were in.  I do appreciate the assistance with this.​

    ------------------------------
    John Heck
    ------------------------------



  • 7.  RE: Forcing upper case letters in a datacard or text field entry

    Posted Feb 06, 2023 02:04 PM
    Hello @Larry Heimendinger, I cannot get the Upper() function to work that way.  This was one of the first things I tried.

    Thanks for the suggestion.  I do wish it was that simple or at least have a switch to force upper case would be nice.​

    ------------------------------
    John Heck
    ------------------------------



  • 8.  RE: Forcing upper case letters in a datacard or text field entry

    Top Contributor
    Posted Feb 07, 2023 01:35 AM
    Edited by Warren Belz Feb 07, 2023 01:36 AM
    Disregard . . .



  • 9.  RE: Forcing upper case letters in a datacard or text field entry

    Posted Feb 07, 2023 09:05 AM
    I tried the following and it seemed to work;

    Set the Text input field OnChange to:
    Set(vtext,Upper(TextInput1.Text))

    Then set the default of the TextInput1 textbox to vtext
    Finally, set DelayOutput true

    That allows me to type into the text field and it only changes to upper after a delay.

    ------------------------------
    Dean Morgan
    Azure Architect
    Irmo
    ------------------------------



  • 10.  RE: Forcing upper case letters in a datacard or text field entry

    Posted Feb 08, 2023 03:31 PM
    Hello @Dean Morgan, thank you for your input.  @Warren Belz gave the same solution just a few more steps that made it work exactly as I wanted it to.  Though it would be so nice to have Microsoft to add a switch on the data card field that would force upper case.

    ------------------------------
    John Heck
    ------------------------------