Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

Textinput allows negative numbers and % sign in number format

Posted on by 490

I am using textinput in powerapp form. I noticed it allows negative number despite choosing as number format in the type.

May i know how to avoid negative numbers?

It also allows % symbol if i key in with some number. For eg: if i enter10% it allows which should not be the case. May i know how to avoid?

 
Categories:
  • Suggested answer
    SebS Profile Picture
    SebS 4,149 on at
    Textinput allows negative numbers and % sign in number format
    Hi,
     
    In OnChange Property place code:
     
    If(
        !IsNumeric(Self.Value) || Value(Self.Value) < 0 || Find("%", Self.Value) > 0,
     
        Notify("Please enter a valid positive number without symbols.", NotificationType.Error)
    )
     
    That Should sort it out, Now if You use new Modern control TextInput You can also add this to your ValidationState propery
    If(
        !IsNumeric(Self.Value) || Value(Self.Value) < 0 || Find(
            "%",
            Self.Value
        ) > 0,
        "Error",
        "None"
    )

    Also change TriggerOutput property to
    'TextInputCanvas.TriggerOutput'.Delayed

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,591

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,090

Leaderboard