cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Required Fields (Not using forms)

Good day, PA community.

I need to have a few input boxes be required before the submission of a patch to a SQL DB.  What seems to be a straightforward process is proving to be more difficult than I had originally thought.  I am returning a message when the 3 input boxes are left blank but it seems as though my 'Else' statement doesn't trigger once all required fields are populated.  Below is a snippet of the code I have written.  I've tried several different methods to no avail.

 

If(
    IsBlank(inpPremium),
    UpdateContext({varRequiredFields: true});
    IsBlank(inpCollateral),
    UpdateContext({varRequiredFields: true});
    IsBlank('inpCheck#'),
    UpdateContext({varRequiredFields: true}),
    UpdateContext({varRequiredFields: false});
    UpdateContext(
        {
            RecordCount: CountIf(
                '[dbo].[ARParameters]',
                Account = drpAccount.Selected.Result,
                GroupNumber = drpGroupNumber.Selected.Result,
                PolicyYear = drpPolicyYear.Selected.Result
            )
        }
    );
    If(
        RecordCount > 0,
        UpdateContext({varShowDuplicateRecord: true}),
        Patch(
            '[dbo].[ARParameters]',
            Defaults('[dbo].[ARParameters]'),
            {
                Account: drpAccount.Selected.Result,
                GroupNumber: drpGroupNumber.Selected.Result,
                PolicyYear: drpPolicyYear.Selected.Result,
                TotalReceipt: Value(dspTotalReceipt.Text),
                PremiumAmount: Value(inpPremium.Text),
                CollateralAmount: Value(inpCollateral.Text),
                PostDate: inpPostDate.SelectedDate,
                CheckNumber: Value(inpCheckNum.Text),
                SubmittedBy: User().FullName,
                Approved: "No"
            }
        )
    )
);
UpdateContext({varShowSuccess: true});

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

I normally do this by setting a variable to be true only if all three values are set.  Then simply use that value to disable the submit button using the Display mode if they aren't all filled in.  If you get more than two or three you can also use the Onchange event to increment/decrement a counter to see if all the values have been filled in.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

5 REPLIES 5
Highlighted
Dual Super User III
Dual Super User III

I normally do this by setting a variable to be true only if all three values are set.  Then simply use that value to disable the submit button using the Display mode if they aren't all filled in.  If you get more than two or three you can also use the Onchange event to increment/decrement a counter to see if all the values have been filled in.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Highlighted

I hadn't thought of using the display mode of the button.  That's actually a great idea.  I'll give that a try

Highlighted

That worked perfectly.  While it doesn't display a text label to alert the user, it prevents them from submitting an incomplete record which is even better. Thank you.

Highlighted

@Kgray15 

One of my favorites - I even did a video on it that you might like (second half is all about custom input "forms").  Hope that gives you some more detail.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Highlighted
Dual Super User III
Dual Super User III

You can add a label to the screen and do the same logic in the visible property to show the label when they haven't completed the fields.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,260)