NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Niels Larsen on August 11, 2010, 07:42:30 AM

Title: Datepicker - disabling single days
Post by: Niels Larsen on August 11, 2010, 07:42:30 AM
Hi

I have played with Datepicker and it's greate!!
The only thing I need to finish my project is the ability to disable single days.
One step could be to implement the uility function noWeekends( )
A small hint would be a great help...

Regards Niels Larsen
Title: Re: Datepicker - disabling single days
Post by: Bruce on August 11, 2010, 09:36:23 PM
The Weekends part is easy, in the embed right before the date is generated set

loc:options = 'beforeShowDay: jQuery.datepicker.noWeekends'

Adding other individual days, like public holidays and so on is a bit harder. but there's some really useful information on doing this here;

http://stackoverflow.com/questions/501943/can-the-jquery-ui-datepicker-be-made-to-disable-saturdays-and-sundays-and-holida (http://stackoverflow.com/questions/501943/can-the-jquery-ui-datepicker-be-made-to-disable-saturdays-and-sundays-and-holida)

Cheers
Bruce
Title: Re: Datepicker - disabling single days
Post by: Niels Larsen on August 11, 2010, 10:50:43 PM
Thanks - I'll give it a try..
Title: Re: Datepicker - disabling single days
Post by: Alberto on August 12, 2010, 03:20:32 AM
Bruce, I cant make it work.
If I add the loc:option....
The date picker button disapears.
Alberto
Title: Re: Datepicker - disabling single days
Post by: Niels Larsen on August 12, 2010, 09:57:24 AM
Hi Alberto

This works for me:
loc:options = CLIP(loc:options) & ',beforeShowDay: jQuery.datepicker.noWeekends'

/Niels
Title: Re: Datepicker - disabling single days
Post by: Niels Larsen on August 12, 2010, 10:56:17 AM
Hi
Now my script to disable individual dates works. But only if I add it as a global script.
I would like to generate it at runtime. Any way to but something above the </head> on a webForm??
/Niels
Title: Re: Datepicker - disabling single days
Post by: Bruce on August 12, 2010, 06:23:09 PM
Hi Alberto,

Usually means the string is wrong in some way. Be careful deciding whether to add your new options to the existing options, or to create new options. If your string is wrong though, the date lookup fails.

cheers
Bruce

Title: Re: Datepicker - disabling single days
Post by: Bruce on August 12, 2010, 06:24:34 PM
Hi Niels,

it doesn't have to be in the <head> - anywhere on the page is fine.

A form is a control (as is a browse) so it doesn't have a <head> section - the head section is only on the page on which the browse /  form is located.

cheers
Bruce
Title: Re: Datepicker - disabling single days
Post by: Niels Larsen on August 13, 2010, 01:31:23 AM
It works. ;D
Thanks Bruce. Great to learn something new. Life is wonderful ...
Title: Re: Datepicker - disabling single days
Post by: Alberto on August 13, 2010, 03:42:58 AM
Now my script to disable individual dates works.
Neils, please, may you share your code?
Thanks
Alberto
Title: Re: Datepicker - disabling single days
Post by: Alberto on August 13, 2010, 03:45:11 AM
Bruce, I dont know which PR are Neils using, I´m using PR28, but I´ve tried with his code:

loc:options = CLIP(loc:options) & ',beforeShowDay: jQuery.datepicker.noWeekends'

and the date picker button dissapears.

Alberto
Title: Re: Datepicker - disabling single days
Post by: Niels Larsen on August 13, 2010, 09:28:15 AM
Hi Alberto

I have modifyed example 1. Added date options on the first date-field in the MailboxesFormControl.
Se attached app+dct C63 9059 NT PR28

God luck
/Niels

[attachment deleted by admin]
Title: Re: Datepicker - disabling single days
Post by: Bruce on August 13, 2010, 06:32:46 PM
Hi Alberto,

If loc:options is blank before your line (which it may be) then you mustn't add the leading ','.

Cheers
Bruce