Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Lionsanime Directory   High Bandwidth Dedicated Servers   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 04-11-2006, 01:55 AM   #1 (permalink)
v7n Mentor
 
JamieJelly's Avatar
 
Join Date: 03-09-06
Location: London UK
Posts: 2,802
iTrader: 0 / 0%
JamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest order
AJAX problem

I have basically ripped apart an AJAX tutorial so I can use it for my own devices. However, the code I have come up with doesn't work!

Can anyone see what is wrong with this code? What is supposed to happen is when someone finishes entering their telephone number, a PHP script is called which stores the information in a DB.

Code:
... <script type="text/javascript"> var requester = null; var formRequester = null; window.onload = init; /* Initialisation for JS capable browsers */ function init() { /* declare form variables as JS variables */ var fullName = document.getElementById("fullName"); var telNumber = document.getElementById("telNumber"); telNumber.onchange = onchangeTelNumber; telNumber.onblur = onchangeTelNumber; orderForm.onsubmit = checkForm; return true; } function onchangeTelNumber() { if (requester != null && requester.readyState != 0 && requester.readyState != 4) { requester.abort(); } try { requester = new XMLHttpRequest(); } catch (error) { try { requester = new ActiveXObject("Microsoft.XMLHTTP"); } catch (error) { requester = null; return false; } } requester.open("GET", "incompleteform.php?fullName=" + fullName.value); requester.send(null); return true; } </script> ... <form> <fieldset> <legend>Step 1: Personal Details</legend> <label for="email">Email Address (where you want the quote sent to)</label> <input type="text" id="email" name="email" class="text" title="email address" /> <label for="fullName">Full Name</label> <input type="text" id="fullName" name="fullName" class="text" title="full name" /> <label for="houseNumber">House/Flat Number</label> <input type="text" id="houseNumber" name="houseNumber" class="text" title="house number" /> <label for="postCode">Postcode</label> <input type="text" id="postCode" name="postCode" class="text" title="postcode" /> <label for="telNumber">Telephone Number (to prevent ID theft)</label> <input type="text" id="telNumber" name="telNumber" class="text" title="telephone number" /> <input name="submit" type="submit" value="submit" /> </fieldset> </form> ...
At the moment the code is only supposed to call the PHP script with one form variable just so I can get it working, but I can't even manage that!

Any help? thanks
JamieJelly is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 04-11-2006, 09:37 AM   #2 (permalink)
QT_
Contributing Member
 
Join Date: 10-13-03
Location: San Antonio, Tx
Posts: 387
iTrader: 0 / 0%
Latest Blog:
None

QT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really nice
Hi there. It looks like you have nothing triggering the javascript. You can try adding an "onchange=" tag to the <input> tag for the telephone number.

-- <input type="text" name="telephone" onchange="return jsFunction()">
QT_ is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-11-2006, 09:44 AM   #3 (permalink)
v7n Mentor
 
JamieJelly's Avatar
 
Join Date: 03-09-06
Location: London UK
Posts: 2,802
iTrader: 0 / 0%
JamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest orderJamieJelly is a web professional of the highest order
Thanks, I have managed to work it out though. The variable I was trying to send to my PHP script wasn't defined in the function.

The onchange event is in the init function
JamieJelly is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add AJAX? birdbrain24 Coding Forum 1 02-05-2008 10:03 AM
AJAX: bots hitting AJAX scripts kkiely Coding Forum 1 04-21-2007 01:14 AM
AJAX in IE7 help SasaVtec Coding Forum 1 01-12-2007 11:53 AM
AJAX Bredd S Webmaster Revenue 4 08-09-2006 12:59 PM
AJAX kwvarga Coding Forum 8 12-18-2005 09:24 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 01:57 PM.
© Copyright 2008 V7 Inc