NetTalk Central

Author Topic: Datepicker - disabling single days  (Read 7484 times)

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 431
    • View Profile
    • Email
Datepicker - disabling single days
« 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

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Datepicker - disabling single days
« Reply #1 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

Cheers
Bruce

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 431
    • View Profile
    • Email
Re: Datepicker - disabling single days
« Reply #2 on: August 11, 2010, 10:50:43 PM »
Thanks - I'll give it a try..

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Datepicker - disabling single days
« Reply #3 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
-----------
Regards
Alberto

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 431
    • View Profile
    • Email
Re: Datepicker - disabling single days
« Reply #4 on: August 12, 2010, 09:57:24 AM »
Hi Alberto

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

/Niels

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 431
    • View Profile
    • Email
Re: Datepicker - disabling single days
« Reply #5 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

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Datepicker - disabling single days
« Reply #6 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


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Datepicker - disabling single days
« Reply #7 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

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 431
    • View Profile
    • Email
Re: Datepicker - disabling single days
« Reply #8 on: August 13, 2010, 01:31:23 AM »
It works. ;D
Thanks Bruce. Great to learn something new. Life is wonderful ...

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Datepicker - disabling single days
« Reply #9 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
-----------
Regards
Alberto

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Datepicker - disabling single days
« Reply #10 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
-----------
Regards
Alberto

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 431
    • View Profile
    • Email
Re: Datepicker - disabling single days
« Reply #11 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]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Datepicker - disabling single days
« Reply #12 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