Skip to main content
Cadet | Tier 2
September 9, 2022
Question

How to select a future date in a datepicker, where the text box is disabled(Read only field).The calendar has a drop downs for the months and years?

  • September 9, 2022
  • 9 replies
  • 416 views
How to select a future date in a datepicker, where the text box is disabled(Read only field).The calendar has a drop downs for the months and years?

    9 replies

    Navigator | Tier 3
    September 13, 2022

    Hi Lesley,

     

    You will have to create a custom domxpath by understand the datepicker pattern.

     

    If you do not know how to work with custom domxpath, I would suggest you to check this article, it will help you.

     

    Thanks

    LesleyAuthor
    Cadet | Tier 2
    September 13, 2022

    @Ikshit Dhawan​ Please see the below image of the calendar, with regards to the custom domxpath how I will select a future date, that must be current system:date + 30 days?Will I need a While and If statement so that it may loop for 30 days?

     

    Navigator | Tier 3
    September 13, 2022

    @Tebogo Moloto​ , I am sorry but you missed to upload an image

    LesleyAuthor
    Cadet | Tier 2
    September 13, 2022

    @Ikshit Dhawan​ Please find attached image of calendar

    LesleyAuthor
    Cadet | Tier 2
    September 13, 2022

    @Ikshit Dhawan​ The below image is how my loop looks like

    LesleyAuthor
    Cadet | Tier 2
    September 13, 2022

    @Ikshit Dhawan​ I was able to add the current date plus 30 days to the innerhtml which works however how will I be able to make sure the month and year is also catered for when it comes to adding the 30 days, do I need to use a while condition look at the current month and year?

    LesleyAuthor
    Cadet | Tier 2
    September 13, 2022

    The below image is how my loop looks like

    Navigator | Tier 3
    September 13, 2022

    No, To add 30 days, use DateTime Package Add > 30 days and save it into a variable (assuming you created datetime variable as 30PlusDays)

    Then Use To String Action from DateTime Package > Source Date will be 30PlusDays and Custom Format MMMM (it should be caps 4 times MMMM) will give you full month name (like October)

    Using this value you can choose the month, similarly you can get the year and day value and select those values in the picker