UI page Dateitme picker - disallow selection of past dates

vinitha3
Tera Guru

This is the code in the UI page, how to disable the past dates here?

<tr>

              <td><label for='date'>Date(yyyy-mm-dd)</label></td>

                <td><input id="start_date_row1" value="" name="start_date_row1" type="text" ReadOnly="True" required="required">

<span style="margin: 2px"></span>

<a onclick="new GwtDateTimePicker('start_date_row1', 'yyyy-MM-dd', false);"><img id="anchorstart_date_row1x" title="Choose date..." name="anchorstart_date_row1x" class="button" src="images/small_calendar.gifx" border="0" height="16" width="16"></img></a></input></td>

          </tr>    

Thanks,

Vinitha.K

1 REPLY 1

ggiri1
ServiceNow Employee
ServiceNow Employee

Hi Vinitha,



Try the below:


https://stackoverflow.com/questions/42383889/how-could-i-disable-past-dates-in-php-datepicker



Your code will be like as follows:



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">




<html>


  <head>


  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"/>


      <script>https://code.jquery.com/jquery-1.12.4.js"></script>


      <script>https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>


      <script>


      $( function() {


      $( "#shootdate" ).datepicker({


      minDate: 0


      });


      });


      </script>


  </head>


      <body>


      <label for="shootdate">Desired Date:</label>


      <input type="text" name="shootdate" id="shootdate" title="Choose your desired date"/>


      </body>


</html>




</j:jelly>



Thanks,


Giri Guntoju