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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / If a certain choice se...
Power Apps
Unanswered

If a certain choice selected from dropdown, show an error message

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, 

 

I'm trying to find out how to show an error message if a certain choice is selected in a drop down. 

 

I have a dropdown menu in a form where one of the options is '-' and I want to make it so that if anyone selects that option, they are unable to submit the form and an error message comes up saying 'please select another option'. 

 

So far I've tried this:

If(DataCardValue4.Value= "-", Notify("Please Select a Team", Error, 4000), SubmitForm(Form1_1) & Navigate(BrowseScreen1, ScreenTransition.UnCover))
 
but I'm getting an error on the formula. Can anyone help? 
Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @BT168 

    You have a text concatenation symbol (&) in your formula.  This will produce an error.

    I am not sure if your logic is to show an error and then navigate to the other screen, but if so, then this should be your formula:

    If(DataCardValue4.Value= "-", 
     Notify("Please Select a Team", Error, 4000), 
     
     SubmitForm(Form1_1);
     Navigate(BrowseScreen1, ScreenTransition.UnCover)
    )

     

    Some recommendations are to put your Navigate function in the OnSuccess action of your Form1_1.  This way the user would only navigate to the screen if the submit is successful.  With your formula, they would navigate regardless of success.

     

    Also, you might consider changing the DisplayMode of your submit button to this instead:

    If(DataCardValue4.Value= "-", Disabled, Edit)

    And your submit OnSelect to :  SubmitForm(Form1_1)

    And again, the Navigate in the OnSuccess.

    This is more "App-like" than popping up error notices.

    Just a suggestion.

     

    I hope this is helpful for you.

  • BT168 Profile Picture
    Microsoft Employee on at

    @RandyHayes 

     

    Ah great recommendations thank you! I'm still relatively new to PowerApps so good to get these tips and tricks. 

     

    However when I put in 

    If(DataCardValue4.Value= "-", Disabled, Edit)

    in the DisplayMode of my submit button, I get an error on the .Value part saying the name isn't valid and the identifier isn't recognised? 

     

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @BT168 

    Sorry...typing too quick without the aide of a formula editor syntax checker...

    This should be the formula:

    If(DataCardValue4.Selected.Value= "-", Disabled, Edit)

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard