Page 1 of 1

Getting Code to Run

Posted: Sat Feb 14, 2009 3:03 pm
by millsy007
I have some javascript/AJAX that runs a php script to output a coach schedule into a html table. It takes the value that is in the 'date' text box and brings out the matching data.
The code works when it is called by a seperate 'get schedule' button click.
However what I want to happen is - the user select a date using a calendar, this date be entered into the textbox, and then upon the onChange of this textbox containing the date the javascript be called.

However my onChange is only working when a user manually enters a date.
Or after the user clicks the calendar, the problem with this is that it would use the date currently in the date textbox when running the getschedule() whereas I want it to use the date the user is selecting after selecting from the calendar

Code: Select all

 
<input type="text" name="date" id="date" size=25 onChange="GetSchedule()">
<a href="#" onClick="cal18.select(document.forms[0].date,'calendar','MM/dd/yyyy'); GetSchedule();"  name="calendar" id="calendar" style="border:none">
<img src="images/calendar.png" border="0" align="top"></a>
 
The GetSchedule is the last to be called, yet is still wont pass in the newly selected date to the GetSchedule code? Is there some php I could write to sort this?

Re: Getting Code to Run

Posted: Sat Feb 14, 2009 11:58 pm
by JAB Creations
With 42 posts I don't see how you could not know this belongs in the Client Side forum.

Secondly use Firefox, use XHTML instead of HTML, validate your XHTML, and then use Firefox's error console to debug your JavaScript code.

By looking up and fixing errors you'll speed up your coding much quicker then waiting for replies in the wrong forum. :wink:

Re: Getting Code to Run

Posted: Sun Feb 15, 2009 12:39 am
by josh
Firebug has breakpoints and is better for debugging

Re: Getting Code to Run

Posted: Sun Feb 15, 2009 7:51 am
by millsy007
Thanks for the replies, I posted it here because, as I stated in my post, after trying everything I could with javascript do get the code to run with the newly selected date I thought that php code may be necersary and was looking for some guidance as to whether this is the case.

I changed the doctype and checked, however I dont think it is an error so much as the javascript not doing what I need.