Hi Mates,
I would like to validate the Date Field.
Condition1. When the field is blank mean if the User has not selected any value then it should display the Custom text "Date is required "
Condition 2. When User selected Future date means Today or Past but not future date, then it should display like "Only today or Past "
If you understand here
Condition 1 validation has to trigger when only hit the submit button because when the user entered into the new screen it should not display until unless hit the button to save.
Condition2 has to display if the user selects only the Future date.
I have already tried for both i don`t work
condition2, it's working fine
ErrorMessage Text property "Only today or Past ",
ErrorMessage Visible: If(date.Selected >=Today+1,true,false)
but I would like to integrate with both
Condition 1 what I have tried
On-Screen Visible
UpdateContext({showDate: Blank()})
Button on selected
UpdateContext({showDate: "Date is requred"})
Now
Error message Text property is updated with below
If(IsBlank(Date.SelectedDate), ShowDate, "Date Should be Today")
Visible property I am not sure but just tried with below
And(Parent.Valid,Date.SelectedDate >= Today()+1)
Here only Condition 2 is working but not condition 1 Means
when I select the future date it shows "Date should be Today"
But without entering when I try to submit it's not showing any ting and it allows to saving.
any help, how can it works with both.
Solved! Go to Solution.
Consider the following to achieve what you want.
UpdateContext({lclMessage: If(IsBlank(Date.SelectedDate), "Date is Required", Blank())})
If(IsBlank(lclMessage), SubmitForm(yourForm)
Set the Text property of your error message label to the following:
Coalesce(lclMessage, If(Date.SelectedDate > Today(), "Only today or Past"))
Set the DisplayMode of your submit button to the following:
If(yourFormName.Valid, Edit, Disabled)
I hope this is helpful for you.
Consider the following to achieve what you want.
UpdateContext({lclMessage: If(IsBlank(Date.SelectedDate), "Date is Required", Blank())})
If(IsBlank(lclMessage), SubmitForm(yourForm)
Set the Text property of your error message label to the following:
Coalesce(lclMessage, If(Date.SelectedDate > Today(), "Only today or Past"))
Set the DisplayMode of your submit button to the following:
If(yourFormName.Valid, Edit, Disabled)
I hope this is helpful for you.
User | Count |
---|---|
209 | |
94 | |
84 | |
49 | |
39 |
User | Count |
---|---|
265 | |
104 | |
104 | |
61 | |
59 |