Only allow satursday in the date picker

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
jamesyesjames
User
Posts: 22

Only allow satursday in the date picker

Post by jamesyesjames »

Hi all!

I have a date field using the Pop-up Calendar and would like it to only allow the user to select a date which is a Saturday.
(phpmaker v10)
Is this possible?

Is there a validation which would do this?
My date format is dd/mm/yyyy

Please Help!
Many thanks again,

James


scs
User
Posts: 694

Post by scs »

$("#your_datepicker_field_here").datepicker({
beforeShowDay: function (date) {
var day = date.getDay();
return [(day == 6)];
}
});


jamesyesjames
User
Posts: 22

Post by jamesyesjames »

Thanks SCS,

I have just tried this solution and put it in the StartUp Script as below, but is doesn't make any difference?
Please help, Thanks!

$("#x_Week_Ending_date").datepicker({
beforeShowDay: function (date) {
var day = date.getDay();
return [(day == 6)];
}
});


scs
User
Posts: 694

Post by scs »

Example are using JQuery UI

Please take a look @ http://www.hkvforums.com/viewtopic.php?f=4&t=27818

You might get the idea


danielc
User
Posts: 1601

Post by danielc »

You may use Form_CustomValidate client script to validate your input. See Server event and Client script in help file.

Here is the hint (javascript) not complete code:
var day = date.getDay(); // this will get 0 (Sunday), 1 (Monday), ..., 6 (Saturday)
if (day < 6)
// return this.OnError(fobj.elements["x_yourfield"], "Sunday - Friday is not valid input");


Post Reply