cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
msv
Helper I
Helper I

date picker defaults back to today's date after an error is encountered while submitting

Hello

 

I have a date picker field which uses below formula for the default property. If the form is in new mode the date automatically defaults to today's date. But when I clear the date using the clear button and then change the default date by picking a date from the calendar followed by an error on submission of the form then the date field defaults back again to today's date. This happens only when the error is encountered, which I dont want to happen. How can I avoid this behavior?

 

If(MakeBlank1,Blank(),If(EntryTypeVar="New",Today(),Parent.Default))

 

Clear button On Select property

 

UpdateContext ({MakeBlank1:true});Reset(DatePicker6)

 

Reset button On Select property

 

UpdateContext ({MakeBlank1:false});

 

 

 

On success property of the form has below formula

UpdateContext({MakeBlank1:false});

 

On failure property of the form has below formula

UpdateContext({MakeBlank1:false});

 

On reset property of the form has below formula

UpdateContext({MakeBlank1:false});

4 REPLIES 4
WarrenBelz
Super User III
Super User III

Hi @msv ,

You would need to reset EntryTypeVar on error as if still true will set the date to Today.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

msv
Helper I
Helper I

Thank you for your reply. Do you mean I need to tweak the above formula that I used. Can you please elaborate with the tweaked formula so that I can relate?

WarrenBelz
Super User III
Super User III

@msv ,

I cannot see your model, so I do not know where you want the EntryTypeVar retaining its value, but one certainly needing resetting is the on failure of the form

UpdateContext(
   {
      MakeBlank1:false,
      EntryTypeVar:Blank()
   }
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

msv
Helper I
Helper I

I tried above it did not work. I have set the EntryTypeVar on start to New. This is a global variable to set the form to new or edit mode

 

Set(EntryTypeVar,"New");

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (28,558)