Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Selected date field value lost when clicking OK without previously losing focus

(0) ShareShare
ReportReport
Posted on by 50

Hello,

We are facing a problem if just after selecting a date we press the OK button of the page without previously losing the focus from the date field. In this case, the OnValidate trigger of the date field never fires, and we lose the selected date, using the old one in the action triggered by the OK button.

2020_2D00_07_2D00_14_5F00_11h36_5F00_22.png

Is there any way to validate the field value just after selecting the date and without losing the focus? 

Please note that, "Due date" field is part of a ListPart included into a WorkSheet page.

Thanks in advance for any suggestions.

--

Belén

  • BelenSA Profile Picture
    50 on at
    RE: Selected date field value lost when clicking OK without previously losing focus

    Hello Zaahed. I'm afraid we haven't found a work around for this yet. Also I just checked it in a 18.3 BC version and the issue is still happening.

    I hope you find a way to solve it and you can share it with us.

  • Zaahed Profile Picture
    5 on at
    RE: Selected date field value lost when clicking OK without previously losing focus

    Hi Belen, I seem to have come across the same issue. When a date is selected from a Date field on the page and the immediate next action is a drill down on another field, the new value from the date-picker is not yet validated into the date field The Date field still has an old value. Have you managed to find a workaround for this? or do you still experience the issue

  • BelenSA Profile Picture
    50 on at
    RE: Selected date field value lost when clicking OK without previously losing focus

    The thing is that when pressing OK, OnQueryClosePage trigger fires to execute the OK action and no validation has happened in the date field. The logic in OK needs the new valuie of the date field but on the contrary, since it has not been validated, it processes the old value. Then page closes.

  • Suggested answer
    Avinash B Profile Picture
    1,455 on at
    RE: Selected date field value lost when clicking OK without previously losing focus

    The field will be validated on clicking OK button if you have not pressed the tab button.

  • BelenSA Profile Picture
    50 on at
    RE: Selected date field value lost when clicking OK without previously losing focus

    Yes, the solution is to lose the focus (pressing tab or clicking anywhere else outside the field) before clicking OK button. However, we can not assume that users will do that before clicking OK.

    We were thinking about a workaround to solve it since with text fields is not happening the same as with the date field. If after writing in a text field, we press OK without previously changing the field focus, the text is not lost. Could it be anything related to date fields not validating the value after date is chosen in the date picker?

  • Suggested answer
    Avinash B Profile Picture
    1,455 on at
    RE: Selected date field value lost when clicking OK without previously losing focus

    Yes. this is the reason you lose the data after clicking on OK button.

    And once you select the Due Date, press tab button which will trigger the OnValidate trigger.

  • BelenSA Profile Picture
    50 on at
    RE: Selected date field value lost when clicking OK without previously losing focus

    Thanks for the idea. However, DelayedInsert is not set.

    We are working with temporary records in the listpart, by setting SourceTableTemporary = true. Could the issue be related to this?

  • Suggested answer
    Avinash B Profile Picture
    1,455 on at
    RE: Selected date field value lost when clicking OK without previously losing focus

    Hi,

    Check if the DelayedInsert is set on the Page.

    Regards

    Avinash B

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,063

#2
YUN ZHU Profile Picture

YUN ZHU 1,002 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 810

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans