Topic: Datepicker window.open

ulf pro asked 6 years ago


Hello. Is it possible to open a new window, with the date in the url, when you click on a date in datepicker. Look at https://www.restaurangerisverige.se/karlskoga/strandkanten/notan/calendar.asp This is the code: $(function() { $("#show").click(function(){ $("p").show(); }); $( "#datepicker" ).datepicker({ onSelect: function(dateText, inst) { window.open('admin_personnel_add.asp?dat=' + dateText,'_parent'); }, showWeek: false, changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", dayNamesMin: ['Sön', 'Mån', 'Tis', 'Ons', 'Tor', 'Fre', 'Lör'], monthNames: [ "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" ], firstDay: 1 //showOn: "button", //buttonImage: "images/calendar-blue.png", //buttonImageOnly: true, }); }); Best regards /Ulf

Jakub Strebeyko staff answered 6 years ago


Hi, There is no explicit answer for this rather specific request in the docs per se. In turn, the docs page mentions event hooks, where you can "hook up" your own functionalities in specific moments of daypicker's lifespan. In this case, what you need is a function taking place onClose(), which opens a new browser window with an address generated upon the daypicker's value. With Best Regards, Kuba

ulf pro answered 6 years ago


Hi. Sorry for the link not working properly. Try this link https://www.restaurangerisverige.se/karlskoga/strandkanten/notan/calendarshow.asp I can't find the answer in datepicker docs.  Best regards /Ulf

Jakub Strebeyko staff answered 6 years ago


Hi there Ulf, Welcome back to the Support Board! The task seems completely doable - only two doubts I may have regard the example (where it seems you need to be logged in for it to properly work) and then the way you initiate the picker (through .datepicker() rather than .pickadate() method). Except for that you seem good to go - please refer to datepicker docs for more info about event handlers and proceed in writing your own date-embedded url logic. With Best Regards, Kuba

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags