cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ajilakes
Advocate II
Advocate II

Submit Button

Good afternoon,

 

Today I am working on a PowerApp at work and need some assistance with the submit button. I am trying to get 5 data cards answered before a user can submit a form. 

 

I am trying to get First Name, Last Name, Badge Type, Start Date and End Date 
I have a few pictures that will be able to explain it better.

Look forward to hearing from you all!
Capture.PNGCapture2.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

@Ajilakes 

Then we have to modify the earlier statement.

 

If(
    And(
        !IsBlank(DataCardValue3.Text),
        !IsBlank(DataCardValue4.Text),
        Or(
            // condition for any status other than lost or deactivate
            !IsEmpty(DataCardValue3.Selected)
            && !IsBlank(DataCardValue5.SelectedDate)
            && !IsBlank(DataCardValue6.SelectedDate),
            // condition for statuses lost or deactivate
            DataCardValue3.Selected.Value in ["Lost/Damaged","Deactivate (Terminated/Retired)"]
            && && !IsBlank(DataCardValue6.SelectedDate)
        )
    ),
    Edit,
    Disabled
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

8 REPLIES 8
Drrickryp
Super User
Super User

Hi @Ajilakes 

You didn't mention where you put your formula.  It should be in the DisplayMode property of the button. 

mdevaney
Super User
Super User

@Ajilakes 

My suggestion can be found below.  The ( ! ) symbol means the same as NOT.  Therefore, the code says "when all the fields are NOT blank change the Display Mode to Edit".

Make sure to place this code in the DisplayMode property of the button.

 

If(
    And(
        !IsBlank(DataCardValue3.Text),
        !IsBlank(DataCardValue4.Text),
        !IsEmpty(DataCardValue3.Selected),
        !IsBlank(DataCardValue5.SelectedDate),
        !IsBlank(DataCardValue6.SelectedDate)
    ),
    Edit,
    Disabled
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

@mdevaney 

@Drrickryp 

 

My issue is that when I select the deactivate badge type and fill out the option it won't allow me to submit since I don't have the start date Datacard. With Reactivate we have an end date and start date and it works with that. I will show you the pictures to explain better and yes I was putting the code in the DisplayMode of Submit Button.

Look forward to hearing from you all

 

Start Date doesn't work for Lost/Damaged

Start Date and End Date work for Reactivate/Expired

End Date for Deactivate doesn't work

 

 

Capture3.PNGCapture4.PNGCapture5.PNG

@mdevaney 

It didn't work for Deactivate and Lost/Damaged. I will attach a few photos to show you what is happening. I have also been putting that code in Submit Buttons (DisplayMode). It works for Reactivate which has both the start and end date. 

 

Look forward to hearing from you

 

Capture3.PNGCapture4.PNGCapture5.PNG

@Ajilakes 

Everything appears to be working properly per your original spec.  You said "disable the button until these 5 fields all have values", correct?  In your screenshot the disable button appears to be working as I expected because either start or end date information is missing.

 

Please let me know if you have different requirements.

@mdevaney 

Everything is working so far but the issue is that for Deactivate I have the start date filtered out on the form. When someone selects Lost/Damage badge type they only see a Start Date because I have the End Date filtered out on the form for this badge type. The issue is when someone tries to fill out the form for Deactivate the submit button won't appear because it's still expecting the start date but it's filtered out on this part. The same things happen to Lost/Damaged badge types when someone tries to fill out the information they won't be able to submit because the End Date is filtered out for this part of the form. 

@Ajilakes 

Then we have to modify the earlier statement.

 

If(
    And(
        !IsBlank(DataCardValue3.Text),
        !IsBlank(DataCardValue4.Text),
        Or(
            // condition for any status other than lost or deactivate
            !IsEmpty(DataCardValue3.Selected)
            && !IsBlank(DataCardValue5.SelectedDate)
            && !IsBlank(DataCardValue6.SelectedDate),
            // condition for statuses lost or deactivate
            DataCardValue3.Selected.Value in ["Lost/Damaged","Deactivate (Terminated/Retired)"]
            && && !IsBlank(DataCardValue6.SelectedDate)
        )
    ),
    Edit,
    Disabled
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

I was able to solve this with the code given above but I did some fixture on what I needed from the data fields. 

So here is my code:

 

If(
And(
!IsBlank(DataCardValue3.Text),
!IsBlank(DataCardValue4.Text),
Or(
// condition for any status other than lost or deactivate
DataCardValueStatus.Selected.Value in ["New Employee"] && !IsEmpty(DataCardValueStatus.Selected.Value) && !IsBlank(DataCardValue5.SelectedDate),
// condition for statuses lost or deactivate
DataCardValueStatus.Selected.Value in [
"Lost/Damaged",
"Deactivate (Terminated/Retired)"
] && !IsBlank(DataCardValue5.SelectedDate) || !IsBlank(DataCardValue6.SelectedDate),
// condition for statuses visitor or reactivate/expired
DataCardValueStatus.Selected.Value in [
"Reactivate/Expired",
"Visitor"
] && !IsBlank(DataCardValue5.SelectedDate) && !IsBlank(DataCardValue6.SelectedDate)
)
),
Edit,
Disabled
)

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,102)