• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • 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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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