All Forums >> [Scripting] >> WSH & Client Side VBScript >> Making Calendar Control Popup on text-box focus and close on selection Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
I'm attempting to build a data access page that for events that contains a date picker that opens as a pop-up window when a user enters a text box, and closes when the user makes a selection.
Can anyone assist? I'd like something along the lines of
your on-focus-handler for the text box would have to open a modal form containing the date picker, setting its state accordingly; then your code must check, whether the user aborted the dialog or selected a date; then the textbox value has to be updated.
I think it would be easier to avoid the textbox and use the datepicker directly. Then the user can either enter a date or use the picker's select pop up = drop down.
Hey thanks for your points there. Building a new data access page was something I was hoping to avoid with the VBA 'onfocus visible = true' bit that works on a form, but not a data access page. Is there another way around this, perhaps by setting the calendar control to have a width of 0px but to enlarge to 200px on the text box's onfocus or onclick events?
My data access page has two date fields - From: [date] and To: [date] so having the calendar control appear twice would take up loads of room on a page that has a 400px width maximum.
Thanks again for your help, ehvbs, I may end up attempting to build that modal form since I've spent so long fannying about trying to get 'visibility=visible' to work unsuccessfully!
Excellent! I figured it out, all I was missing was the 'style' bit.
The DateFrom and DateTo are fields that need filling out from the Calendar Control. After making both calendar controls 'hidden' in their properties/format/visibility I wrote the following code that works and is effective: