简体   繁体   中英

How do i disable or enable dates according to user choice in jquery-ui-datepicker?

I have some user profile page where in the url has the username(unique key). eg- > www.example.com/abhiram_giri

I have one date picker input field. I want the date enable according to user choice. Eg- If one user want that every friday will enable and a specific date which occur friday will disable. And I want the total no of enable date will be according to user choice from the current day. Means user may want only 10 friday visible from the current day. Every user have database so that they have some choice for date stored in database. I know how to disable or enable date but i cant for different user has different choice. plz help me.

user should give their demand that when there username appear on url then only

one user want only 10 days to enable from the current date to future which are friday but not the date 26-04-2013 and 10-05-2013. Another user may want 15 days to enable from current date which are only 2nd monday of the month or date 6th of the month

I used the jquery files here

code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css

code.jquery.com/ui/1.10.2/jquery-ui.js

code.jquery.com/jquery-1.9.1.js

For enable and disable purpose i followed this site Click here

These steps I would try:

  1. Read the dates that should be enabled/disabled out of the database
  2. write it into JS Objects (inside a js-script Block):

    echo 'var disabledDays = ["9-21-2010", "9-24-2010"];';

OR if you have the dates in an array:

echo 'var disabledDays = '.json_encode($disabledDays).';';

after that you can call the JS-functions

disableAllTheseDays(date);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM