I've been using the Validate function to check form values for errors prior to submission based on the default required fields in my form, however I have noticed a strange issue where required fields, when left blank, are initially successfully caught by the validate function if no data is added to them, but if I enter text to make it pass validation from a required field, then remove that text to make it blank again, the validate function doesn't catch that the required field is blank anymore.
Does anyone know if this is a bug or somehow by design?
Steps to replicate:
- Create a form "MainForm" referencing a sharepoint list with two or more required fields.
- Create a button to check for errors. Button onSelect code:
// Check for errors before presenting confirmation dialog
Set(
varValidateForm,
Validate(
'My SharePoint List',
Defaults('My SharePoint List'),
MainForm.Updates
)
);
// If there are no errors submit, otherwise notify
If(
IsBlank(varValidateForm),
Submit(MainForm)
,
// Otherwise highlight validation Errors.
Notify(
varValidateForm,
NotificationType.Error
)
);
- Create a new item, hit the button (should see an error about the required field being blank).
- Add some text to the first required field and hit submit (that field should no longer throw an error and it'll flag the next required field error instead).
- Remove the text entered into the initial required field and submit (the error for the first field error doesn't get flagged again despite there being no data in the field anymore).
Related Function: Validate function - Power Platform | Microsoft Learn


Report
All responses (
Answers (