Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Making Calendar Control Popup on text-box focus and close on selection

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,53486
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
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!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Making Calendar Control Popup on text-box focus and clo... - 11/13/2007 4:11:39 AM   
  adampope

 

Posts: 5
Score: 0
Joined: 11/13/2007
Status: offline
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

<script language=vbscript event=onfocus for=DateFrom>
<---
activeXctrl1.visible = true
activeXctrl1.click visible = false
-->

where activeXctrl is the calendar control but this is a million miles off working!

I'm working in Access 2003...

Thanks for your help!
H From: try { if (MSODSC.CurrentSection == null) MSODSC.DataPages(0).NewRecord(); else MSODSC.CurrentSection.DataPage.NewRecord(); } catch (e) { alert (e.description);} try { if (MSODSC.DataPages.Count > 0) if (MSODSC.CurrentSection == null) MSODSC.DataPages(0).Save(); else MSODSC.CurrentSection.DataPage.Save(); } catch (e) { alert (e.description);} try { if (MSODSC.CurrentSection == null) MSODSC.DataPages(0).NewRecord(); else MSODSC.CurrentSection.DataPage.NewRecord(); } catch (e) { alert (e.description);}
Header-->: tblEven
but this is a million miles off working!t From: try { if (MSODSC.CurrentSection == null) MSODSC.DataPages(0).NewRecord(); else MSODSC.CurrentSection.DataPage.NewRecord(); } catch (e) { alert (e.description);} try { if (MSODSC.DataPages.Count > 0) if (MSODSC.CurrentSection == null) MSODSC.DataPages(0).Save(); else MSODSC.CurrentSection.DataPage.Save(); } catch (e) { alert (e.description);} try { if (MSODSC.CurrentSection == null) MSODSC.DataPages(0).NewRecord(); else MSODSC.CurrentSection.DataPage.NewRecord(); } catch (e) { alert (e.description);}



try { if (MSODSC.CurrentSection == null) MSODSC.DataPages(0).NewRecord(); else MSODSC.CurrentSection.DataPage.NewRecord(); } catch (e) { alert (e.description);}

 
 
Post #: 1
 
 RE: Making Calendar Control Popup on text-box focus and... - 11/13/2007 4:16:44 AM   
  ehvbs

 

Posts: 2169
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi adampope,

your code looks like Javascript to me. Do you want to 'port' it to VBScript?


Regards

ehvbs

(in reply to adampope)
 
 
Post #: 2
 
 RE: Making Calendar Control Popup on text-box focus and... - 11/13/2007 4:33:54 AM   
  adampope

 

Posts: 5
Score: 0
Joined: 11/13/2007
Status: offline
Sorry, I don't know where that mess at the bottom of my post came from. 

Yes, it does need to be in vbscript, javascript would just be too confusing for me...

(in reply to ehvbs)
 
 
Post #: 3
 
 RE: Making Calendar Control Popup on text-box focus and... - 11/13/2007 4:59:55 AM   
  ehvbs

 

Posts: 2169
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi adampope,

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.

Regards

ehvbs

(in reply to adampope)
 
 
Post #: 4
 
 RE: Making Calendar Control Popup on text-box focus and... - 11/13/2007 7:54:42 AM   
  adampope

 

Posts: 5
Score: 0
Joined: 11/13/2007
Status: offline
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!

(in reply to ehvbs)
 
 
Post #: 5
 
 RE: Making Calendar Control Popup on text-box focus and... - 11/13/2007 8:43:35 AM   
  ehvbs

 

Posts: 2169
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
To hide the Date Picker, you could try:

  <obj>.style.display = "none"

(in reply to adampope)
 
 
Post #: 6
 
 RE: Making Calendar Control Popup on text-box focus and... - 11/13/2007 11:44:17 PM   
  adampope

 

Posts: 5
Score: 0
Joined: 11/13/2007
Status: offline
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:

<SCRIPT language=vbscript event=onfocus for=DateFrom>
<!--
ActiveXCtl0.style.visibility = "visible"
-->
</SCRIPT>
<SCRIPT language=vbscript event=Click for=ActiveXCtl0>
<!--
ActiveXCtl0.style.visibility = "hidden"
DateTo.focus
DateTo.value = DateFrom.value
ActiveXCtl1.style.visibility = "visible"
-->
</SCRIPT>
<SCRIPT language=vbscript event=Click for=ActiveXCtl1>
<!--
Title.focus
ActiveXCtl1.style.visibility = "hidden"
-->
</SCRIPT>

(in reply to ehvbs)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Making Calendar Control Popup on text-box focus and close on selection Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts