Skip to main content

Notifications

Community site session details

Community site session details

Session Id : EGUNnu5DMHVcfD4kkHVs7g
Power Apps - Building Power Apps
Unanswered

Do not allow to input plus or minus sign to "Amount" field in Form (absolute values only)

Like (0) ShareShare
ReportReport
Posted on 25 Jan 2023 11:39:10 by 26

Hi Experts !

 

looking for solution to block some sign for Users in form.

I have a field "DataCardValue" which is for "Amount" input.

End users are adding "-" and "+" signs all the time, which messing up the report in Power BI, where we visualize data.

 

Is there any way to restrict that and let them only input numbers?

No special signs, no letters, just pure numbers (decimals).

 

I have no idea how to do that, just created a prompt which is "visible" when user input "-" or "+"sing.

But it does not work for end users, they still enter those signs, so I want to block that permanently for that one field alone.

 

Would be grateful for help/ advice on that 🙂

Patryk92_0-1674646448557.png

Patryk92_1-1674646478741.pngPatryk92_2-1674646491820.png

Patryk92_3-1674646680675.png

 

 

  • BCBuizer Profile Picture
    22,027 Super User 2025 Season 1 on 25 Jan 2023 at 15:03:47
    Re: Do not allow to input plus or minus sign to "Amount" field in Form (absolute values only)

    Hi @Patryk92,

     

    Try this then:

     

    Set the Default property of the TextInput to:

     

    Coalesce(
     locNumber,
     Parent.Default
    )

     

     

    The insert a slider control with the below properties:

     

    Visible = false
    Default = Len(DataCardValue9.Text)
    OnChange = UpdateContext({locNumber:With({_Value:Trunc(DataCardValue9.Text)},If(_Value<0,_Value*-1,_Value))});
     Reset(TextInput5);

     

     

    What this does, is every time something is typed in the DataCardValue, the text is taken and manipulated:

    Value removes and "+",

    Trunc removes any ".",

    The If statement removes any "-"

     

    This is then saved in a local variable which is will be displayed be default in the DataCardValue because it is reset.

     

    The only thing to take into consideration is to set the local variable back to blank when the user submits the form (in the OnSuccess property of the form) or when the user navigates away from the screen. This is important because otherwise the DataCardValue may display a wrong value.

  • Patryk92 Profile Picture
    26 on 25 Jan 2023 at 12:19:12
    Re: Do not allow to input plus or minus sign to "Amount" field in Form (absolute values only)

    Hi !
    Thanks for answer on my query 🙂

     

    I tested what you suggested

    IsNumeric(DataCardValue9.Text)

    Patryk92_0-1674647799380.png

    just for the "warning label", and seems that this formula is evaluating "-1234" and "1234" and "+1234" as "true", so it does not work as expected 😞

    what is needed is to evaluate "-1234" and "+1234" as false, and only "1234" as true

    in this field characters (letters) are blocked anyway by the Property > Format = Number, but this does not block "-" and "+" from entering to that field

     

    Maybe there is a way to "clear" the field if it contains "-" or "+" sign or any other way to achieve that?
    Not sure about that... hmm

  • BCBuizer Profile Picture
    22,027 Super User 2025 Season 1 on 25 Jan 2023 at 11:46:03
    Re: Do not allow to input plus or minus sign to "Amount" field in Form (absolute values only)

    Hi @Patryk92 ,

     

    You can use this condition to validate if the contents are numeric: 

     

    IsNumeric(DataCardValue9.Text)

     

    This condition can be used to, for instance, block the user from submitting the form and show a warning.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,662 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started