Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 22nd, 2003, 01:48 PM
Registered User
 
Join Date: Aug 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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!

Code:
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;        

    window.open("Includefiles/Cal.asp?target="+TargetField+"&title="+WindowTitle+"&dtValue="+dtValue+"&today="+today,"Calendar","width=200,height=200,resizable=no,scrollbars=no,top=50,left=50");

}


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" 
size="10" 
readonly
onclick="javascript:document.frmRequest.howOften(0).checked=true;javascript:theLastDay.style.display='none';javascript:OpenCalWindow('Date','calStartDate')"
onchange="javascript:CalcDate()"
style="cursor:hand;" 
title="Click to show calendar">
Reply With Quote
  #2 (permalink)  
Old August 22nd, 2003, 02:15 PM
Registered User
 
Join Date: Aug 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.


http://www.experts-exchange.com/Web/..._20431888.html

Hope this helps someone else!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SqlDependency OnChange Event ghari ASP.NET 2.0 Professional 1 July 30th, 2008 03:01 PM
onChange event mcinar HTML Code Clinic 3 May 24th, 2007 08:46 PM
onChange Event mcinar Javascript 11 May 11th, 2007 09:38 AM
how to use onchange event of dropdownlist check_007 ASP.NET 2.0 Professional 2 February 16th, 2007 02:57 AM
Event:OnChange catchrohith Classic ASP Basics 0 November 3rd, 2006 12:52 AM



All times are GMT -4. The time now is 06:40 AM.


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