Forum Stats

  • 3,769,403 Users
  • 2,252,961 Discussions
  • 7,875,020 Comments

Discussions

Date Picker: Setting Minimum date

AnnelizeF
AnnelizeF Member Posts: 139 Red Ribbon

Hi

Running APEX 21.1.2 (cloud)

We need to set a minimum date for one of our Date Picker fields, and have achieved this by setting the Minimum Static date to -0d as demonstrated in the image below:


This prevents the user from selecting any date in the past for Hiredate and works well on insert. (demonstration details below)

However, when I then attempt to update any other page items for a record with a Hiredate already set previously in the past, I will get the following error: Hiredate must be on or after 28-Sep-2021. (replace the date with today's date)

This is because the Hiredate is being evaluated before the user Saves by -0d even when I'm not making changes.

One way to get around the problem, is to move my validation out of the Date Picker settings and only in the validating process, however we don't want the user to ever have the option of selecting an incorrect date. We don't want to validate at the point of Save only.

We also don't want to make the HireDate readonly.

Any idea of how to get around this problem, please?

-- Demo --

Page 5: Interactive Report

Workspace: af_plays

Login: demo / _af_plays 

To demo: Edit an existing employee record by clicking on the employee number hyperlink. Edit the salary on the modal window. The Hiredate will give an error message.

Thanks,

Annelize

Tagged:

Best Answers

  • Chandler Bing
    Chandler Bing Member Posts: 176 Bronze Badge
    Accepted Answer

    hi,

    Check your application.

  • AnnelizeF
    AnnelizeF Member Posts: 139 Red Ribbon
    edited Sep 28, 2021 11:15AM Accepted Answer

    Thank you!

    You solved the problem by creating a page item on the modal page: P6_DATE_CHECK with a default of SYSDATE and then setting the min value of HIREDATE to &P6_DATE_CHECK. instead of -0d

    You then added HIREDATE to the linked column's set items to populate P6_DATE_CHECK when you edit the record.

    This worked, however I changed it slightly to keep the changes to one page (P6)

    Instead of sending HIREDATE when the user opens the record, I set the source of P6_DATE_CHECK to the page item P6_HIREDATE if the value in session state is NULL

    Works like a charm.

    StewStrykerNH

Answers

  • Chandler Bing
    Chandler Bing Member Posts: 176 Bronze Badge
    Accepted Answer

    hi,

    Check your application.

  • AnnelizeF
    AnnelizeF Member Posts: 139 Red Ribbon
    edited Sep 28, 2021 11:15AM Accepted Answer

    Thank you!

    You solved the problem by creating a page item on the modal page: P6_DATE_CHECK with a default of SYSDATE and then setting the min value of HIREDATE to &P6_DATE_CHECK. instead of -0d

    You then added HIREDATE to the linked column's set items to populate P6_DATE_CHECK when you edit the record.

    This worked, however I changed it slightly to keep the changes to one page (P6)

    Instead of sending HIREDATE when the user opens the record, I set the source of P6_DATE_CHECK to the page item P6_HIREDATE if the value in session state is NULL

    Works like a charm.

    StewStrykerNH