Edit: I didn't see your reply before sending this one, so i will test the updated code 🙂
Edit2: @LaurensM i tested the updated code, with the snippet below, and now it seems to let me through - however, it seems to skip the E-mail validation, as i can now submit the form with an invalid e-mail (no @-sign) - any suggestions?
Hi - well, doesn't seem like i'm completely lost then 🙂
However, i am not quite sure how to get it to work, as it still brings up the error message and doesn't allow me to proceed, as long as the e-mail input field remains empty.
I'm unsure how the toggle in the first part needs to be setup, but i'm willing to bet that this is not exactly what you had in mind (tried both with and without the = "Yes", as is shown below):
If(
//Either the Toggle = false or the email has to be valid (adjust the Toggle name to the correct one)
!Radio2.Selected.Value || IsMatch(EmailInput.Text; "^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+.([a-zA-Z0-9]{2,4})+$");
Patch(
'External Visitor List 2';
Defaults('External Visitor List 2');
{
'First name':FirstNameInput.Text;
'Last Name':LastNameInput.Text;
Company:CompanyInput.Text;
Host:HostNameInput.Text;
'Start date':DatePicker1.SelectedDate;
'End date':If(DatePicker2.Visible; DatePicker2.SelectedDate);
'Key required?':Radio2.Selected.Value;
'E-Mail':EmailInput.Text
}
);;
//Check for errors on our Patch() statement
If(
IsEmpty(Errors('External Visitor List 2'));
//In case no errors were found, execute the following functions
UpdateContext({locReset:true});;
UpdateContext({locReset:false});;
Navigate(CompletionScreen;ScreenTransition.Fade)
);
//In case the email was invalid, notify the user
Notify("Email not valid"; NotificationType.Error)
)
Also, do i need to change anything in the properties of the input fields themselves (other than what is already setup for toggling visibility of fields based on prior input), or should it all be able to work from the button itself, without further changes?