I have the following in the "Required" field of a data card. I don't want the form to submit if either of the conditions are true. (See comments in code). The only time this works and won't allow you to save the record is for the 2nd condition, but doesn't work for the 1st one. I need insight on how to stop the "Saving" of a record in a form if there are errors such as this. Are there other ways to validate the data.
Or(
If(
And(
Not IsBlank(CurrentDateValue.SelectedDate),
Value(CurrentDateValue.SelectedDate) < Value(PreviousDateValue.SelectedDate)
),
true, false) //true if the current date has a value and it is < previous steps date
,If(
And(
Not IsBlank(NextDateValue.SelectedDate),
IsBlank(CurrentDateValue.SelectedDate)
), //true if filling in next date prior to this date
true,false)
)
Solved! Go to Solution.
The best way to go about this is to disable the submit capability to the user until the form is valid.
Set your DisplayMode property on your submit button to:
If(
IsBlank(CurrentDateValue.SelectedDate) ||
IsBlank(NextDateValue.SelectedDate) ||
CurrentDateValue.SelectedDate < PreviousDateValue.SelectedDate,
Disabled,
Edit
)
If you use the Required property on the datacard for this instead, then you will need to do it for each datacard with those date controls and you would then need to check the IsValid property of the form before SubmitForm.
I hope this is helpful for you.
"I found out that I could Disable submit button if validation errors. Since a similar condition exist for the Error Message associated with the data card and that works. I ended up doing something like this
= If( Not IsBlank(errormsg1.text)||
Not IsBlank(errormsg2.text)
,
Disabled,
Edit)"
Well again, if you put formulas in the Required properties of the datacards, then the only thing you need in your Submit button DisplayMode is:
If(yourForm.IsValid, Edit, Disabled)
So which are you going to utilize, the Required properties or just put it in the DisplayMode (all of it - not the IsValid) property a formula to validate?
The best way to go about this is to disable the submit capability to the user until the form is valid.
Set your DisplayMode property on your submit button to:
If(
IsBlank(CurrentDateValue.SelectedDate) ||
IsBlank(NextDateValue.SelectedDate) ||
CurrentDateValue.SelectedDate < PreviousDateValue.SelectedDate,
Disabled,
Edit
)
If you use the Required property on the datacard for this instead, then you will need to do it for each datacard with those date controls and you would then need to check the IsValid property of the form before SubmitForm.
I hope this is helpful for you.
"I found out that I could Disable submit button if validation errors. Since a similar condition exist for the Error Message associated with the data card and that works. I ended up doing something like this
= If( Not IsBlank(errormsg1.text)||
Not IsBlank(errormsg2.text)
,
Disabled,
Edit)"
Well again, if you put formulas in the Required properties of the datacards, then the only thing you need in your Submit button DisplayMode is:
If(yourForm.IsValid, Edit, Disabled)
So which are you going to utilize, the Required properties or just put it in the DisplayMode (all of it - not the IsValid) property a formula to validate?
Hi Randy
I also have this issue on the MS forms date selection issue. Would you please let me know where to set this to my forms for fix the date select problem, thanks.
User | Count |
---|---|
252 | |
106 | |
96 | |
50 | |
39 |