Hi,
I need some help please.
I have a save button on a already submitted form, for user2 to enter upto 7 approvers. I wanted the save button to display a notification if User2 attempts to save the form without selecting at least 1 user, I thought this may work, it still present a notification, but still submits the form:
If(IsBlank(DataCardValue81.Selected.Email),
If(IsBlank(DataCardValue65.Selected.Email),
If(IsBlank(DataCardValue64.Selected.Email),
If(IsBlank(DataCardValue68.Selected.Email),
If(IsBlank(DataCardValue69.Selected.Email),
If(IsBlank(DataCardValue79.Selected.Email),
If(IsBlank(DataCardValue80.Selected.Email),
Notify("You need to identify at least 1 approver ", NotificationType.Error)
)))))));
SubmitForm(Form1_8);
Office365Outlook.SendEmailV2(Form1_8.LastSubmit........................
what am i doing wrong please?
Solved! Go to Solution.
Ok, I think I misunderstood your original requirements. Here's my correction.
If(
!IsBlank(DataCardValue81.Selected.Email)
Or !IsBlank(DataCardValue65.Selected.Email)
Or !IsBlank(DataCardValue64.Selected.Email)
Or !IsBlank(DataCardValue68.Selected.Email)
Or !IsBlank(DataCardValue69.Selected.Email)
Or !IsBlank(DataCardValue79.Selected.Email)
Or !IsBlank(DataCardValue80.Selected.Email),
SubmitForm(Form1_8),
Notify("You need to identify at least 1 approver ", NotificationType.Error)
)
---
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."
The problem was your code contained a nested IF statement where all of the datacards had to be blank to show and error message. You'll want to take advantage of the OR statement instead.
If(
IsBlank(DataCardValue81.Selected.Email)
Or IsBlank(DataCardValue65.Selected.Email)
Or IsBlank(DataCardValue64.Selected.Email)
Or IsBlank(DataCardValue68.Selected.Email)
Or IsBlank(DataCardValue69.Selected.Email)
Or IsBlank(DataCardValue79.Selected.Email)
Or IsBlank(DataCardValue80.Selected.Email),
Notify("You need to identify at least 1 approver ", NotificationType.Error),
SubmitForm(Form1_8)
)
And you should also move this code to the OnSuccess property of the form so it will only fire when the form is submitted.
Office365Outlook.SendEmailV2(Form1_8.LastSubmit........................
---
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."
Hi @mdevaney
Thanks for your response and advice, ive moved the send email to OnSucess of the form, please see error in the syntax i'm getting:
@Lefty
Your code does not match mine: there are a bunch of open brackets like this ( in front of your IsBlank functions.
---
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."
HI @mdevaney
Thanks, that's what i get when I try to modify my existing code
I've now published and checked its published, when I have no users in any of the fields and i click submit i get the notification 👍
but after i enter a user in 1 field, and i click submit, i still get the notification appear.
If i enter data in all 7 fields i can submit the form.... ideally i need to be able to select just 1 for the notification to not appear and be able to submit the form
Did you make the changes to your code? If yes, can you please take a screenshot?
Ok, I think I misunderstood your original requirements. Here's my correction.
If(
!IsBlank(DataCardValue81.Selected.Email)
Or !IsBlank(DataCardValue65.Selected.Email)
Or !IsBlank(DataCardValue64.Selected.Email)
Or !IsBlank(DataCardValue68.Selected.Email)
Or !IsBlank(DataCardValue69.Selected.Email)
Or !IsBlank(DataCardValue79.Selected.Email)
Or !IsBlank(DataCardValue80.Selected.Email),
SubmitForm(Form1_8),
Notify("You need to identify at least 1 approver ", NotificationType.Error)
)
---
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."