Getting Code to Run

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
millsy007
Forum Commoner
Posts: 78
Joined: Wed Jul 02, 2008 7:00 pm

Getting Code to Run

Post 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?
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: Getting Code to Run

Post 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:
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Getting Code to Run

Post by josh »

Firebug has breakpoints and is better for debugging
millsy007
Forum Commoner
Posts: 78
Joined: Wed Jul 02, 2008 7:00 pm

Re: Getting Code to Run

Post 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.
Post Reply