- see footer for list info -<
Peter,
that looks great. Thanks - I'll have a go now.
Damien
Peter Boughton wrote:
- see footer for list info -<
Firstly, stop using FormName.FieldName, and use the element id instead.
(ie: <input id="course_from" name="CourseDateFrom_1" .../> )
This way, your javascript is not dependant on these two values, and if
you
need to change either of them for whatever reason, the Id can probably
stay
the same.
Then pass through the id in the query string when you open the window,
like
this:
function showCalendar(elem_id)
{
myCal = window.open
('includes/popupCalendar/calendar.html?'+elem_id,'myCal','width=300,height=300');
}
Then in your calendar script, use this function to return the value:
function ret(val)
{
var id = location.href.split('?')[1];
window.opener.document.getElementById(id).value = val;
window.close();
}
Which you would call with something along the lines of this:
<a
href="javascript:ret('<cfoutput>#JsStringFormat(retcal)#</cfoutput>');">#x#</a>
This all allows you to use the showCalendar to call the calendar for any
specified form element, and it will then return the value to that
specified
element when finished.
Hope that all makes sense?
On 12/19/06, Damien Gallagher <[EMAIL PROTECTED]> wrote:
>- see footer for list info -<
I have a javascript popup calendar.
It is opened using:
<a
href="javascript:show_calendar('SailHelpBookingForm.CourseDateFrom_1');"
onmouseover="window.status='Date Picker';return true;"
onmouseout="window.status='';return true;">
<img src="includes/popupCalendar/cal.gif" width=16 height=16
border=0 />
</a>
The variables SailHelpBookingForm and CourseDateFrom_1 refer to the form
name and the name of the form input the instance of the calendar relates
to.
In the calendar window, the date is selected and window closed using:
<a
href="javascript:
window.opener.document.SailHelpBookingForm.CourseDateTo_1.value='
<cfoutput>#retcal#</cfoutput>';
window.close();"
onmouseover="javascript:toggleDisplay('c<cfoutput>#x#</cfoutput>')"
onmouseout="javascript:toggleDisplay('c<cfoutput>#x#</cfoutput>')"><cfoutput>#x#</cfoutput></a>
I need to dynamically change the values for the formname and form input
name in this link
(javascript:window.opener.document.SailHelpBookingForm.CourseDateTo_1)
depending on the variables I set in the first link that opened the
calendar window.
How do I do it?
Thanks, Damien
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help
-<
_______________________________________________
For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo
--
CFDeveloper Sponsors:-
- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<