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});
Solved! Go to Solution.
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.
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.
I hadn't thought of using the display mode of the button. That's actually a great idea. I'll give that a try
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.
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.
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.
User | Count |
---|---|
209 | |
94 | |
84 | |
49 | |
39 |
User | Count |
---|---|
264 | |
104 | |
104 | |
61 | |
59 |