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 / How to write multiple ...
Power Apps
Unanswered

How to write multiple if condition on button 'OnSelect' property ?

(0) ShareShare
ReportReport
Posted on by 4

Hi All,

 

I have a list which I have customized on powerapp form.

1. I have a comment filed which I had rename in data card as "txtApproverComment".

2. I have a choice field called "Status" which is on the form but visible property is false. which has values:- Approved, Rejected, Initiated

3. I have a button called "Reject'.

Now what I want if I click the button 'Reject' then it should first check if "txtApproverComment" is empty then  set  "txtApproverComment" border red and nothing should happen. But if "txtApproverComment" is not empty then 

set "Status" choice field as "Rejected" and form should save. Below is my code "OnSelect" property of Reject button.

If(IsBlank(txtApproverComment), txtApproverComment.BorderColor = Red);

If(!IsBlank(txtApproverComment), ddlStatus.selected.value = 'Rejected'; SubmitForm(EditForm))

but it is not working. txtApproverComment.BorderColor = Red -> not working

                                  ddlStatus.selected.value = 'Rejected' -> not working

 

Please help some one.

Thank you so much !

 

Categories:
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    OnClick:

    Set(varCheckComment,true);

    if( !IsBlank(CommentTextBox),Patch(ListName,ID of the Record you want to update,{Status:ddlStatus.Selected}))

    Comment text box border color property:

    If(varCheckComment = true && IsBlank(Self.Text),Red)

  • KvB1 Profile Picture
    1,596 on at

    What I would do is set the color property of the textbox with an If( function to check if its empty or not.

     

    Also make the displaymode of the reject button dependent on whether the comment textbox is empty or not.

     

    Then you can just have a patch function in the onselect property of the reject button, and you save yourself a lot of hassle

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard