[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 351
  • Last Modified:

How to assign a date value from a calendar popup to a hidden field

I have a search form with a couple of textboxes, dropdownlist controls and a Ajax calendar control. What I would like to do is to show, when picked a date from the calendar, this date in a label control in a ddd, MMM dd, yyyy format. Further I have a range validator to check if the picked date is in the future. If okay submit search form. My question is: can I store the picked date in a hidden field in short date format and manipulate this date to the above format and put this in a label control? I would like to use the hidden field value to query data when submitting the search from. I hope someone out there can help me how to tackle this. Many thanks in advance.

1 Solution
James LooneySr. Programmer/AnalystCommented:
Which datepicker are you using? mootools? jquery? .... ?
PdeLormeAuthor Commented:
AJAX calendarextender control.
Piotr DCommented:
I don't know CalendarExtender, but, according to this page


to get the current selected date, you should add OnClientDateSelectionChanged="updateHiddenField" attribute to your CalendarExtender control, place a hidden input in the form (e.g. <input type="hidden" id="myHiddenInput" />) and declare a javascript function:

function updateHiddenField(sender,args)
    document.getElementById("myHiddenInput").value = sender._selectedDate;

Open in new window


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now