HELP! - want to tie up calendar with form...

S

Stovie

Hi,

I am hoping someone can help me. Using from page I have created a web page
with a form that has two text boxes which need to be populated with a date. I
have created a link which open new windiow with calendar (added via MS FP2003
active X components - calendar 11.0) I have a submit botton under the
calendar which I wish to populate one of the text boxes with the 'date' on
the calendar.

Follwed: http://support.microsoft.com/?kbid=299691

And added following script...(changing form/text names for my own)

<SCRIPT LANGUAGE="vbscript">
<!--
Sub Calendar1_Click()
formname.txtboxname.value = Calendar1.Value
End Sub
-->
</SCRIPT>

It does not work. I cannot seem to relate the two pages so that the calendar
populates the text box with date. Also have tried to add calendar on to a
test form so both are on the same page but again won't work.

Any ideas???

Appreciated
Stovie
 
A

Andrew Murray

At the foot of that page it says "Applies to Frontpage 2002 Standard
Edition". I wouldn't assume it would work in FP2003.
 
A

Andrew Murray

I've got it to work as it is designed to. Make sure you follow the
instructions exactly as written.

I've modified it so you select a date then click the "submit" button - all
on the one page.

I know you've done this, but double check you reference your form name and
the text box in the script

The form name is "MyForm" and the text box name is "txtDate". Try it with
the example names first; then apply it to your own form.

If you want to select a date and use a submit button, then use this VB
function:

<SCRIPT LANGUAGE="vbscript">
<!--

Sub Button1_Click()

MyForm.txtDate.value = Calendar1.value

End Sub
-->
</SCRIPT>

The original function is:
SCRIPT LANGUAGE="vbscript">
<!--
Sub Calendar1_Click()
MyForm.txtDate.value = Calendar1.Value
End Sub
-->
</SCRIPT>

The only change is you put the Click action on the button rather than the
calendar. Then call the function as an onclick from the <input> button:

<input type="button" value="Button1" name="Button1"
onclick="Button1_Click()">

I just don't know how to pass parameters across pages from the calendar to
the text box.


However: you could try a "date picker" javascript, which I think would be
more accessible to more people - http://javascript.internet.com or
http://www.dynamicdrive.com are good resource sites to start.

Even if you download one from the above sites, find out how it is written to
pull the value from one window (the calendar popup) to the form, then you
can apply that to your calendar / form with the VBscript equivalent.

ActiveX controls are risky at best, and many people may not have them turned
on in their browsers/security software, so your idea won't work for many
people; users I think, are (more) likely to have javascript turned on than
ActiveX.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top