Web Services and Add-Ons
Experience the Ultimate in
Quality and Service
Ultimate

© 2014/5 - RichoSoft - All Rights Reserved | Terms of Use | Privacy Policy | About Cookies | Contact

WePlus Tricks
WebPlus Tricks ...

Restrict Date Selection in Datepicker

Restrict Date Selection in Datepicker

This trick works with WebPlus X6 Datepicker.


When you have installed your datepicker on your page and selected your field and named it (id) eg: REQUIREDDATE


You can add the following script code block to the HTML of your page pasting it over the <!--Page End--> tag at the foot of the page.


<script type="text/javascript">

$(function() {

$.datepicker.setDefaults( $.datepicker.regional[ "en-GB" ] );

$( "#REQUIREDDATE" ).datepicker( $.datepicker.regional[ "en-GB" ] );

$( "#REQUIREDDATE" ).datepicker( "option", "dateFormat", "dd/mm/yy" );

$( "#REQUIREDDATE" ).datepicker( "option", "minDate", "7D" );

$( "#REQUIREDDATE" ).datepicker( "option", "maxDate", "1Y" );

$( "#REQUIREDDATE" ).datepicker( "option", "yearRange", "c-0:c+1" );

  });

</script>

Change the items in Yellow: REQUIREDDATE is the ID you gave your text field. MinDate is the minimum date you will accept, eg 7D is seven days in the future from now, -7D is 7 days in the past from now. Use M and Y similarly for months and years.

maxDate works the same way except it is the maximum date you will accept.

yearRange is the years that you will allow eg: c-0:c+1 is No years in the past and 1 year in the future.

Try the box below, You should not be able to enter a date in the past and not more than 1 Year in the future from todays date.


Try entering a date in the past or more than 1 year from now.

About these Utilities

About these Utilities

These tricks will work with the version of WebPlus specified, and are undocumented modifications to the way some WebPlus functions operate.

I strongly recommend you backup your WPP before applying any of the tricks.

I take no responsibility for any undesirable effects caused by implementing any of these Tricks. You use them at your own risk.



 

Here are some simple to install useful tricks to add additional functionality to some WebPlus features.

Click to enter a Date