Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

IF formula to ensure data is entered in fields before proceeding

(0) ShareShare
ReportReport
Posted on by

Hi Guys,

 

I have the below code on my OnSelect to not allow the user to proceed to the next screen unless certain fields are filled in. Could you tell me how I can also include that If 'Dropdown-Status' is set to the option Closed then 'Txt-ImmediateCorrection'.Text must have some text in the box and the same for 'Txt-PermanentPreventative so both boxes must have something entered into the box if the status dropdown is set to closed otherwise they can't proceed to the next screen? If the Status dropdown is set to Open then those 2 text boxes don't require to have data? 

 

If(
 'Dropdown-Classification'.Selected.Value = "Please select an option" || 
 'Dropdown-Status'.Selected.Value = "Please select an option" || 
 'Dropdown-Hours'.Selected.Value = "Hour" || 
 'Dropdown-Minutes'.Selected.Value = "Minutes" || 
 'Dropdown-JobSpecific'.Selected.Value = "Please select an option" ||
 'Dropdown-BusinessUnit'.Selected.Value = "Please select an option" || 
 'Dropdown-SourceFunction'.Selected.Result = "Please select an option" || 
 'Dropdown-CauseCategory'.Selected.Title = "Please select an option" || 
 'Dropdown-Source'.Selected.Value = "Please select an option" || 
 'Dropdown-BusinessChange'.Selected.Value = "Please select an option",
 
 Notify("Please fill out all items, anything highlighted in red requires something entering");
 Set(varOnSubmit, true),
 Navigate(Costs,Cover);
 Set(varOnSubmit, false) 
)

 

 

Many Thanks 

  • Verified answer
    NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at
    Re: IF formula to ensure data is entered in fields before proceeding

    Hi, 

    you can below to border color property of your 2 TextInput fields -

    If(varOnSubmit && 'Dropdown-Status'.Selected.Value = "Closed" && IsBlank(Self.Text), Red, RGBA(0, 18, 107, 1))
  • Dave-ITMan Profile Picture
    on at
    Re: IF formula to ensure data is entered in fields before proceeding

    Hi @NandiniBhagya20  thanks for this, that has worked. Can you advise what I would need to put as the border colour for the two text fields please so that they are red if they haven't been filled in with any information? I have done the below but clearly done something wrong.

     

    If(varOnSubmit & ('Dropdown-Status'.Selected.Value = "Closed"), Red, RGBA(0, 18, 107, 1))

     

    Thanks Again!  

  • PowerRanger Profile Picture
    3,458 Super User 2024 Season 1 on at
    Re: IF formula to ensure data is entered in fields before proceeding

    @Dave-ITMan you could just add another logical test

     

    If(
     'Dropdown-Classification'.Selected.Value = "Please select an option" || 
     'Dropdown-Status'.Selected.Value = "Please select an option" || 
     'Dropdown-Hours'.Selected.Value = "Hour" || 
     'Dropdown-Minutes'.Selected.Value = "Minutes" || 
     'Dropdown-JobSpecific'.Selected.Value = "Please select an option" ||
     'Dropdown-BusinessUnit'.Selected.Value = "Please select an option" || 
     'Dropdown-SourceFunction'.Selected.Result = "Please select an option" || 
     'Dropdown-CauseCategory'.Selected.Title = "Please select an option" || 
     'Dropdown-Source'.Selected.Value = "Please select an option" || 
     'Dropdown-BusinessChange'.Selected.Value = "Please select an option" ||
    
    And('Dropdown-Status'.Selected.Value = "Open",IsBlank(Txt-ImmediateCorrection.Text),IsBlank(Txt-PermanentPreventative.Text)),
    
     
     Notify("Please fill out all items, anything highlighted in red requires something entering");
     Set(varOnSubmit, true),
     Navigate(Costs,Cover);
     Set(varOnSubmit, false) 
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Community Power Platform Member Profile Picture
    on at
    Re: IF formula to ensure data is entered in fields before proceeding

    In these cases I use the updateContext. So in the OnSelect you mentioned, I would doe something like this:

     

    UpdateContext({boolMeetedStatusReq: If(Dropdown-Status.Selected.Value = "Closed" && !IsBlank(Txt-PermanentPreventative.Text),false,true)});

    If(
    boolMeetedStatusReq ||
    'Dropdown-Classification'.Selected.Value = "Please select an option" ||
    'Dropdown-Status'.Selected.Value = "Please select an option" ||
    'Dropdown-Hours'.Selected.Value = "Hour" ||
    'Dropdown-Minutes'.Selected.Value = "Minutes" ||
    'Dropdown-JobSpecific'.Selected.Value = "Please select an option" ||
    'Dropdown-BusinessUnit'.Selected.Value = "Please select an option" ||
    'Dropdown-SourceFunction'.Selected.Result = "Please select an option" ||
    'Dropdown-CauseCategory'.Selected.Title = "Please select an option" ||
    'Dropdown-Source'.Selected.Value = "Please select an option" ||
    'Dropdown-BusinessChange'.Selected.Value = "Please select an option",

    Notify("Please fill out all items, anything highlighted in red requires something entering");
    Set(varOnSubmit, true),
    Navigate(Costs,Cover);
    Set(varOnSubmit, false)
    )
  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on at
    Re: IF formula to ensure data is entered in fields before proceeding

    Hi,

     

    Try adding this to your If statement:

     

    Dropdown-Status.SelectedText.Value = "Closed" && IsBlank(Txt-PermanentPreventative)

  • Verified answer
    NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at
    Re: IF formula to ensure data is entered in fields before proceeding

    You can try using below formula 

    If(
     ('Dropdown-Classification'.Selected.Value = "Please select an option" || 
     'Dropdown-Status'.Selected.Value = "Please select an option" || 
     'Dropdown-Hours'.Selected.Value = "Hour" || 
     'Dropdown-Minutes'.Selected.Value = "Minutes" || 
     'Dropdown-JobSpecific'.Selected.Value = "Please select an option" ||
     'Dropdown-BusinessUnit'.Selected.Value = "Please select an option" || 
     'Dropdown-SourceFunction'.Selected.Result = "Please select an option" || 
     'Dropdown-CauseCategory'.Selected.Title = "Please select an option" || 
     'Dropdown-Source'.Selected.Value = "Please select an option" || 
     'Dropdown-BusinessChange'.Selected.Value = "Please select an option") || ('Dropdown-status'.Selected.Value="Closed" && (IsBlank(TextInputName.Text)|| IsBlank(TextInputName.Text)))) ,
     
     Notify("Please fill out all items, anything highlighted in red requires something entering");
     Set(varOnSubmit, true),
     Navigate(Costs,Cover);
     Set(varOnSubmit, false) 
    )

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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,658 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard