p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Javascript How-To (http://p2p.wrox.com/forumdisplay.php?f=87)
-   -   OnChange Event Doesn't Execute (http://p2p.wrox.com/showthread.php?t=3090)

JLJones13 August 22nd, 2003 01:48 PM

OnChange Event Doesn't Execute
Hi All!

I have a form with a Readonly text field for a date.
When the user clicks on the field, or a calendar icon next to the field, a modal calendar pops-up.
Once the user clicks on a date in the calendar window, the date is inserted into the date text field.

When a date is inserted into the field, I want to call a function to populate an array of dates. However, my OnChange event is not firing.

I have tried placing the code in the OnBlur event, but it executes too often (once when the calendar pops up, next when the user chooses a date and gets back to the field, ...).
And, if I place it with the OnClick event, it causes the event to fire before the date has been entered.

How can I get the OnChange event to execute? Or, if there's a better way, please let me know ;o)

Here's an abbreviated version of the code. Let me know if you need more details...

Thanks in advance!


function OpenCalWindow(WindowTitle,TargetField){
    //date currently in targetfield
    var dtValue = frmRequest.all(TargetField).value;
    //use server current date rather than client
    var today = frmRequest.hidToday.value;       



function CalcDate(){
    //Build an array of dates...
    //and set another field on the form to the last date of the array.

<input type="text"
value name="calStartDate"
title="Click to show calendar">

JLJones13 August 22nd, 2003 02:15 PM

I searched for hours trying to find a solution and couldn't find anything. Then, within 15 minutes of posting this, I found a solution.


Hope this helps someone else!

All times are GMT -4. The time now is 09:49 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.