@joel914823 - assuming you want to preserve the existing out-of-the-box behaviour (display the error warning once the user runs the SubmitForm function on a required field) - you could try:
If(
IsBlank(DateValue1.SelectedDate),
Parent.Error
)
However, because the error message text (Parent.Error) is tied to whenever the data source returns an error, the error message text will continue to be displayed, even if the control inside the datacard has now been populated with a value.
My preference is to control this behaviour more directly. For example:
1. On the OnSelect property of your Submit Button (or whatever you're using to save the record), use:
If(
'Your Form'.Valid,
SubmitForm('Your Form'),
UpdateContext({ctx_highlight_field: true}),
Notify(
"Please complete all mandatory fields",
NotificationType.Warning
)
)
2. On the BorderColor property of the DataCard:
If(
ctx_highlight_field,
Color.Red,
Color.Transparent
)
3. Modify the Text property of the error message Label control with e.g. "The date field is mandatory."
4. Set the Visible property of the Label to:
ctx_highlight_field
5. Set the OnVisible property of the Screen to:
UpdateContext({ctx_highlight_field: false})
Optional: If the Item property of the EditForm is being populated from a Gallery control on the same screen, then on the OnSelect property of the Gallery, include:
UpdateContext({ctx_highlight_field: false})