web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Validate text input if...
Power Apps
Answered

Validate text input if it's exactly the same as in the backend

(0) ShareShare
ReportReport
Posted on by 35

I'm building a form, where the user has to choose an item from a drop down and then add it's price manually to a text field. If the price typed in is incorrect, then an error message should come up.

I am using a collection from an excel table as the backend for validation, I added the below to the error text label in question, but it's not working and I am not sure why.

Coalesce(
Parent.Error,
If(
!IsBlank(DataCardValue31.Value) &&
!IsMatch(DataCardValue31.Value, Dropdown4.Selected.'PO Price')
"Incorrect price"
)
)

 

DataCardValue31: the text label where the price needs to be typed in

Dropdown4: is the field where the price automatically gets filled in, once the user chooses the item from another drop down. This one is not visible, I just wanted to add it for the validation

'PO Price': the name of the column, that contains the correct price in the backend

 

Could someone please help me? Thank you!

validation error.png
Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @macsevet,

     

    Could you try the following code:

    Coalesce(
     Parent.Error,
     If(
     !IsBlank(DataCardValue31.Text) &&
     //Should the condition below throw an error "cannot compare text to number"
     //replace DataCardValue31.Text with Value(DataCardValue31.Text)
     DataCardValue31.Text <> Dropdown4.Selected.'PO Price'
     "Incorrect price"
     )
    )

     

    If this solves your question, would you be so kind as to accept it as a solution.

    Thanks!

  • macsevet Profile Picture
    35 on at

    Thank you @LaurensM for the quick reply! Unfortunately this neither worked 😞
    These errors came up:

    • Expected operator: we expect an operator, such as +, * or &
    • Unexpected characters: characters used in an unexpected way
    • Unexpected characters: contains "Eof" where "ParenClose" is required
    • Incompatible types for comparison (although I tried both methods you mentioned): Number, Error
    • Invalid number of arguments: received 1, expected 2 or more

    Sorry I'm quite a beginner in this, so I don't really have a clue on how to move on 😞

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @macsevet,

     

    My apologies, I should proofread my code more often - I missed a comma after Dropdown4.Selected.'PO Price':

    Coalesce(
     Parent.Error,
     If(
     !IsBlank(DataCardValue31.Text) &&
     //Should the condition below throw an error "cannot compare text to number"
     //replace DataCardValue31.Text with Value(DataCardValue31.Text)
     DataCardValue31.Text <> Dropdown4.Selected.'PO Price',
     "Incorrect price"
     )
    )

     

    I hope this helps!

  • macsevet Profile Picture
    35 on at

    OMG, it worked, thank you so much for your prompt help @LaurensM 🙂

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
Vish WR Profile Picture

Vish WR 482

#3
WarrenBelz Profile Picture

WarrenBelz 384 Most Valuable Professional

Last 30 days Overall leaderboard