Form Element has no properties when querying

This is a discussion on "Form Element has no properties when querying" within the JavaScript Forum section. This forum, and the thread "Form Element has no properties when querying are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Aug 16th, 2006, 17:00
Junior Member
Join Date: Dec 2005
Age: 25
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Form Element has no properties when querying

if you look at the page below and do the following..
1.Click London Postcode
2.Choose Any Postcode
3.Choose Any Car
4.Click Get Quote

http://www.londonheathrowcars.com/ajax/blankquote.asp

what should happen is a 'price.asp' page should load on the left hand side of the page.. query my database and display the results..

nothings is happening tho.. i am not a javascript whiz and when i look at the code i do not fully understand what is happening..

i have installed a firefox plugin that shows javascript errors, i am also using AJAX to load my form components.

the error i receive is this..

document.quoteform.car1 has no properties

and the highlighted line in the code below seems to be where the problem is. does anyone have any ideas why this is happening because i have tested the actual query and the results should work.

there seems however to be a problem with the page recognising which car radio button has been selected.

can anyone help?

My Javascript is below.. the italic functions are the ones concerning this part of the form and as mentioned the bold line is where the error is.. apparently

Code: Select all
function createRequestObject() {
    var ro;
    /*@cc_on
    @if (@_jscript_version >= 5)
        try {
            ro = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                ro = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                ro = false;
            }
        }
    @else
        ro = false;
    @end @*/
    if (!ro && typeof XMLHttpRequest != 'undefined') {
        try {
            ro = new XMLHttpRequest();
        } catch (e) {
            ro = false;
        }
    }
    return ro;
}


var xmlHttp = null;
function LoadPostcodes() {
        xmlHttp = createRequestObject();
        var url="quote1.asp"
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadContentComplete;
        xmlHttp.send('');
}


var xmlHttp = null;
function LoadContent2() {
        xmlHttp = createRequestObject();
        var url="quote2.asp"
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadContentComplete;
        xmlHttp.send('');
}

var xmlHttp = null;
function LoadAirports() {
        xmlHttp = createRequestObject();
        var url="quote3.asp"
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadContentComplete;
        xmlHttp.send('');
}


var xmlHttp = null;
function LoadSeaports() {
        xmlHttp = createRequestObject();
        var url="quote4.asp"
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadContentComplete;
        xmlHttp.send('');
}


function LoadContentComplete() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById('thecellid').innerHTML = xmlHttp.responseText;
   }
}


function LoadCarContent() {
        xmlHttp = createRequestObject();
        var url="cars.asp";
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadCarContentComplete;
        xmlHttp.send('');
}


function LoadCarContentComplete() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById('carcontentid').innerHTML = xmlHttp.responseText;
   }
}


function LoadButton() {
        xmlHttp = createRequestObject();
        var url="button.asp";
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadButtonComplete;
        xmlHttp.send('');
}


function LoadButtonComplete() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById('buttonid').innerHTML = xmlHttp.responseText;
   }
}



function GetPrice() {

            var RadioButtonValue = null;
            for (counter = 0; counter < document.quoteform.car1.length; counter++) {
            if (document.quoteform.car1[counter].checked) {
                RadioButtonValue = quoteform.car1[counter].value;
            }
        
            if (RadioButtonValue!="") {

            xmlHttp = createRequestObject();
            var url="price.asp?PASSMYVALUE=" + RadioButtonValue;
            xmlHttp.open('GET', url, true);
            xmlHttp.onreadystatechange = GetPriceComplete;
            xmlHttp.send('');
            
          } else {
            alert('No option was checked.');
          }
}


function GetPriceComplete() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById('newpricehere').innerHTML = xmlHttp.responseText;
   }
}
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Aug 16th, 2006, 22:04
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

You haven't studied your html code very well.

Your radio buttons have the name 'r1' not 'car1' as you are using in the JavaScript.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Aug 17th, 2006, 11:11
Junior Member
Join Date: Dec 2005
Age: 25
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

NO!

i want to swear but i wont.

look.. the actual radio buttons on the main page are not the ones that are needed to query the database.. they are called r1 that is correct.. but the error im gettin is about the OTHER radio buttons.. the ones in a separate cars.asp page i am loading into a container on the main page..

this is that page!

Code: Select all
<script type="text/javascript" src="ajax.js"></script>
<br>
<p class="mainbody">3. Choose a <b>Vehicle</b>:<br><br>
<input type="radio" VALUE="c1"
name="car1" onMouseOver="style.cursor='pointer'" onclick="LoadButton();">&nbsp;&nbsp;<b>Saloon</b> (1-4 Passengers - 3 Suitcases)
<br><br>
<input type="radio" VALUE="c2"
name="car1" onMouseOver="style.cursor='pointer'" onclick="LoadButton();">&nbsp;&nbsp;<b>Estate</b> (1-4 Passengers - 4 Suitcases)
<br><br>
<input type="radio" VALUE="c3"
name="car1" onMouseOver="style.cursor='pointer'" onclick="LoadButton();">&nbsp;&nbsp;<b>People Carrier</b> (1-6 Passengers - 5 Suitcases)
<br><br>
<input type="radio" VALUE="c4"
name="car1" onMouseOver="style.cursor='pointer'" onclick="LoadButton();">&nbsp;&nbsp;<b>Executive</b> (1-4 Passengers - 3 Suitcases)
<br><br>
they are called car1! why isnt this working!??!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Aug 17th, 2006, 11:55
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

Does this code integrated with the existing form code when it is loaded?

Are you able to show us the page with this code in place?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Aug 17th, 2006, 12:02
Junior Member
Join Date: Dec 2005
Age: 25
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

i will show you absolutely everything if it will help get it fixed.. ok here is the situation..

ONE MAIN PAGE (where everything happens..) this page is called blankquote.asp, within this page are 3 table cells (used as containers) which load different asp pages into them when the user uses the form..

so.. i have it set up at the moment to test the London Postcode radio button.. you click that postcode radio.. and it loads 'quote1.asp' on the rite hand site (which is a drop down with many postcodes)

you choose a postcode and it loads the car selection page 'cars.asp' in another container immediately below it..

when you choose a car radio.. another page.. 'button.asp' loads below

when you click the button, the database should be queried and a final 'price.asp' page should load on the left hand side of the page displaying the results.. this is not happening tho..

here is all the code i got.

im gettin this error
document.quoteform.car1 has no properties on the bold line of the below ajax.js file..

ajax.js
Code: Select all
function createRequestObject() {
    var ro;
    /*@cc_on
    @if (@_jscript_version >= 5)
        try {
            ro = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                ro = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                ro = false;
            }
        }
    @else
        ro = false;
    @end @*/
    if (!ro && typeof XMLHttpRequest != 'undefined') {
        try {
            ro = new XMLHttpRequest();
        } catch (e) {
            ro = false;
        }
    }
    return ro;
}


var xmlHttp = null;
function LoadPostcodes() {
        xmlHttp = createRequestObject();
        var url="quote1.asp"
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadContentComplete;
        xmlHttp.send('');
}


var xmlHttp = null;
function LoadContent2() {
        xmlHttp = createRequestObject();
        var url="quote2.asp"
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadContentComplete;
        xmlHttp.send('');
}

var xmlHttp = null;
function LoadAirports() {
        xmlHttp = createRequestObject();
        var url="quote3.asp"
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadContentComplete;
        xmlHttp.send('');
}


var xmlHttp = null;
function LoadSeaports() {
        xmlHttp = createRequestObject();
        var url="quote4.asp"
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadContentComplete;
        xmlHttp.send('');
}


function LoadContentComplete() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById('thecellid').innerHTML = xmlHttp.responseText;
   }
}


function LoadCarContent() {
        xmlHttp = createRequestObject();
        var url="cars.asp";
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadCarContentComplete;
        xmlHttp.send('');
}


function LoadCarContentComplete() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById('carcontentid').innerHTML = xmlHttp.responseText;
   }
}


function LoadButton() {
        xmlHttp = createRequestObject();
        var url="button.asp";
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadButtonComplete;
        xmlHttp.send('');
}


function LoadButtonComplete() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById('buttonid').innerHTML = xmlHttp.responseText;
   }
}



function GetPrice() {

            var RadioButtonValue = null;
            for (counter = 0; counter < document.quoteform.car1.length; counter++) {
            if (document.quoteform.car1[counter].checked) {
                RadioButtonValue = document.quoteform.car1[counter].value;
            }
        
            if (RadioButtonValue!="") {

            xmlHttp = createRequestObject();
            var url="price.asp?PASSMYVALUE=" + RadioButtonValue;
            xmlHttp.open('GET', url, true);
            xmlHttp.onreadystatechange = GetPriceComplete;
            xmlHttp.send('');
            
          } else {
            alert('No option was checked.');
          }
}


function GetPriceComplete() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById('newpricehere').innerHTML = xmlHttp.responseText;
   }
}
}
blankquote.asp
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<title> | </title>

<meta name="description" content="">
<meta name="keywords" content="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="external.js"></script>
<script type="text/javascript" src="ajax.js"></script>



</head>

<body>
<div id="wrap">
        
        

<div id="bleft">
<h1 class="top">Quick Quote</h1>
<form name="quoteform">
<p class="mainbody">1. Please Choose a Destination:<br><Br>
        <input type="radio" VALUE="v1" name="r1" onMouseOver="style.cursor='pointer'" onclick="LoadPostcodes();">&nbsp;&nbsp;&nbsp;<b>London Postcode</b> (N1, WC2, E14 etc..)<br><br>

        <input type="radio" VALUE="v2" name="r1" onMouseOver="style.cursor='pointer'" onclick="LoadContent2()";>&nbsp;&nbsp;&nbsp;<b>Town / Location</b> (Cambridge, Brighton etc..)<br><br>
        
        <input type="radio" VALUE="v3" name="r1" onMouseOver="style.cursor='pointer'" onclick="LoadAirports()";>&nbsp;&nbsp;&nbsp;<b>UK Airport</b> (Gatwick, Stansted etc..)<br><br>
        
        <input type="radio" VALUE="v4" name="r1" onMouseOver="style.cursor='pointer'" onclick="LoadSeaports()";>&nbsp;&nbsp;&nbsp;<b>UK Seaport</b> (Dover, Harwich etc..)<br><br>



<table width="100%" border="0" cellspacing="0">
  <tr>
    <td id="newpricehere"></td>
  </tr>
</table>
</div>


<div id="bright">
<table width="100%" border="0" cellspacing="0">
  <tr>
    <td id="thecellid"></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0">
  <tr>
    <td id="carcontentid"></td>
  </tr>
    <tr>
    <td id="buttonid"></td>
  </tr>
</table>
</form>

</div>


            
</div>
</body>
</html>
quote1.asp
Code: Select all
<%
set myconn = Server.CreateObject("ADODB.connection")
connection = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &_
Server.MapPath("/_db_import/prices.mdb") & ";"
myconn.open (connection)

set rs=Server.CreateObject("ADODB.recordset")
rs.Open "Select townNAME from tblTOWN", myconn
%>
<script type="text/javascript" src="ajax.js"></script>
<h1 class="top">Travel From Heathrow</h1>
<p class="mainbody">2. Select a <b>London Postcode</b>:<br>
    <select class="droppy" name="postcode" onChange="LoadCarContent();">
<option value="">...</option>
<%
if not rs.eof then
do until rs.eof
%>
<option class="grey" value="<%=rs("townName")%>"><%=rs("townName")%></option>
<%
rs.movenext
loop
end if
%>
</select>
</p>
cars.asp
Code: Select all
<script type="text/javascript" src="ajax.js"></script>
<br>
<p class="mainbody">3. Choose a <b>Vehicle</b>:<br><br>
<input type="radio" VALUE="c1"
name="car1" onMouseOver="style.cursor='pointer'" onclick="LoadButton();">&nbsp;&nbsp;<b>Saloon</b> (1-4 Passengers - 3 Suitcases)
<br><br>
<input type="radio" VALUE="c2"
name="car1" onMouseOver="style.cursor='pointer'" onclick="LoadButton();">&nbsp;&nbsp;<b>Estate</b> (1-4 Passengers - 4 Suitcases)
<br><br>
<input type="radio" VALUE="c3"
name="car1" onMouseOver="style.cursor='pointer'" onclick="LoadButton();">&nbsp;&nbsp;<b>People Carrier</b> (1-6 Passengers - 5 Suitcases)
<br><br>
<input type="radio" VALUE="c4"
name="car1" onMouseOver="style.cursor='pointer'" onclick="LoadButton();">&nbsp;&nbsp;<b>Executive</b> (1-4 Passengers - 3 Suitcases)
<br><br>
button.asp
Code: Select all
<script type="text/javascript" src="ajax.js"></script>
<p><input style="margin-top:20px;margin-bottom:30px;margin-left:35px;background-color:#666666;font-weight:bold;font-size:12px;font-family:arial;color:white;width:100px;" value="Get Quote" name="B1" type="submit" onclick="GetPrice();"></p>
<Br><br><br>
price.asp
Code: Select all
<h1 class="top">Hello</h1>

<%
DIM sPostCode, sCarSelection, sCarModel

sPostCode = trim(request.form("postcode"))
sCarSelection = ucase(request.form("car1"))

if sCarSelection = "C1" then
sCarModel = "Saloon"
elseif sCarSelection = "C2" then
sCarModel = "Estate"
elseif sCarSelection = "C3" then
sCarModel = "People Carrier"
elseif sCarSelection = "C4" then
sCarModel = "Executive"
end if


DIM myconn, connection, rs

set myconn = Server.CreateObject("ADODB.connection")
connection = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &_
Server.MapPath("/_db_import/prices.mdb") & ";"
myconn.open (connection)

set rs=Server.CreateObject("ADODB.recordset")
rs.Open "Select price from h2t where cartype = '" & sCarSelection & "' and destination = '" & sPostCode & "' ", myconn
%>

<%
DIM sTempVar
sTempVar = "&#"
%>
<p class="mainbody">Listed below are the details of your journey:</p><br>
<p class="mainbody">Pickup: <b>Heathrow</b><br><br>Destination: <b><%=sPostCode%></b><br><br>Car: <b><%=sCarModel%></b><br><br>Price: <b><%=sTempVar & "163;" & trim(rs("price"))%></b></p>
<br>
</body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Aug 17th, 2006, 13:08
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

Just thought I'd throw this in while trying to figure out what's going on.

The .innerHTML function is non-standard. It's deprecated by the W3C as it is basically an IE function. Although Firefox does support its use, it apparently only does so within table cells if you wrap everything in the cell in a <div>.

As you are already having problems with this development, it might be worth looking for a standards version of doing this using the core DOM functionality.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Aug 17th, 2006, 13:23
Junior Member
Join Date: Dec 2005
Age: 25
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

my friend.. does this 'core DOM functionality' require a deep understanding of javascript, because i do not have this..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Aug 17th, 2006, 13:32
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

You seem to have a fair grasp of things given the code you have or did you not code what you are currently trying to get working.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Aug 17th, 2006, 13:36
Junior Member
Join Date: Dec 2005
Age: 25
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

i did not code any of the js..

ajax was introduced to me 2 days ago.. and i managed to manipulate one of the alrady present functions to simply open a new page in a new container.. thats is..

i basically want my quote system to be faster and easier to use.. but obviously i need to prioritise accessibility...

im stuck now, i thought if i could get my current method working it would all be good..

what do you think i shud do..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Aug 17th, 2006, 13:37
Junior Member
Join Date: Dec 2005
Age: 25
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

*thats it.. not thats is
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Aug 17th, 2006, 17:03
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

Started having a closer look at your code.

In the page; http://www.londonheathrowcars.com/ajax/blankquote.asp,
you have a link to a JavaScript file - external.js.

This file isn't any such thing, it's an html page in its own right.

Can't say for sure but this may well be the route cause of the problem as the browser is total confused about what JavaScript it's loaded. Anyway, it needs sorting out so we can at least eliminate it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12  
Old Aug 17th, 2006, 23:39
Junior Member
Join Date: Dec 2005
Age: 25
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

the external.js file is just coding to open a link in a new window because as u may know the target="_blank" and _new are no longer standard..

could that really be causing all this mess.. im currently not at my terminal with the website but i will be tomorrow.. i will remove that and see what happens.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13  
Old Aug 25th, 2006, 13:13
Junior Member
Join Date: Dec 2005
Age: 25
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

can somebody please please give me some help here.. it is an ongoing thing i need to fix..

here is the page, if you could briefly look at it, and go through the form process, so you see what is happening:

http://londonheathrowcars.com/ajax/blankquote.asp

im using ajax to load separate parts of the form into table cells on the main page.. the separate parts of the form are other asp pages.. which just have the code for the form item and no <html></html> tags

here is an example of one of the form elements..it is called when the user clicks London Postcode. the quote1.asp page is loaded into the thecellid container on the blankquote.asp page..

in this case the drop down is populated from my database.

quote1.asp page (the postcodes in the drop down menu)
Code: Select all
<%
set myconn = Server.CreateObject("ADODB.connection")
connection = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &_
Server.MapPath("/_db_import/prices.mdb") & ";"
myconn.open (connection)

set rs=Server.CreateObject("ADODB.recordset")
rs.Open "Select townNAME from tblTOWN", myconn
%>
<script type="text/javascript" src="ajax.js"></script>
<p class="mainbody">2. Select a <b>London Postcode</b>:<br>
    <select class="droppy" name="postcode" onChange="LoadCarContent();">
<option value="">...</option>
<%
if not rs.eof then
do until rs.eof
%>
<option class="grey" value="<%=rs("townName")%>"><%=rs("townName")%></option>
<%
rs.movenext
loop
end if
%>
</select>
</p>
my main page is called blankquote.asp

here is the code
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<title> | </title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css">

<script type="text/javascript" src="ajax.js"></script>

</head>

<body>
<div id="wrap">

<div id="bleft">
<h1 class="top">Quick Quote</h1>

<form name="quoteform">

<!-- The first section of the form is in the main page code-->

<p class="mainbody">1. Please Choose a Destination:<br><Br>
<input type="radio" VALUE="v1" name="r1" onMouseOver="style.cursor='pointer'" onclick="LoadPostcodes();">&nbsp;&nbsp;&nbsp;<b>London Postcode</b> (N1, WC2, E14 etc..)<br><br>
</p>

<!-- The last 3 stages of the form open in the three containers below -->

<table width="100%" border="0" cellspacing="0">
  
  <tr>
    <td id="thecellid"></td>
  </tr>

  <tr>
    <td id="carcontentid"></td>
  </tr>

  <tr>
    <td id="buttonid"></td>
  </tr>

  </table>

</form>

</div>

<div id="bright">

<!-- The finished result will load here on the right div -->

<table><tr><td id="newpricehere"></td></tr></table>
</div>

</div>
</body>
</html>
basically if you look at how the original quote system functioned here..
http://www.londonheathrowcars.com/price-search3a.asp

all the form elements were present on the parent page code and i was able to query my database and retreive a quote for the journey..

the reason i am using ajax is to create a step by step process, with the form elements appearing in relevant stages..

My Problem
i was told that even tho the form elements were on different pages being called individually, as long as the containers were in between the <form></form> tags then the page should be able to read the values and query the database.

when you click the get quote button, it should query the database and load the results on the right hand side of the page..but nothing is happening.. can anyone give me some kind of advice here please..

lastly.. here is my ajax.js file
Code: Select all
function createRequestObject() {
    var ro;
    /*@cc_on
    @if (@_jscript_version >= 5)
        try {
            ro = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                ro = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                ro = false;
            }
        }
    @else
        ro = false;
    @end @*/
    if (!ro && typeof XMLHttpRequest != 'undefined') {
        try {
            ro = new XMLHttpRequest();
        } catch (e) {
            ro = false;
        }
    }
    return ro;
}


var xmlHttp = null;
function LoadPostcodes() {
        xmlHttp = createRequestObject();
        var url="quote1.asp"
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadContentComplete;
        xmlHttp.send('');
}


var xmlHttp = null;
function LoadContent2() {
        xmlHttp = createRequestObject();
        var url="quote2.asp"
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadContentComplete;
        xmlHttp.send('');
}

var xmlHttp = null;
function LoadAirports() {
        xmlHttp = createRequestObject();
        var url="quote3.asp"
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadContentComplete;
        xmlHttp.send('');
}


var xmlHttp = null;
function LoadSeaports() {
        xmlHttp = createRequestObject();
        var url="quote4.asp"
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadContentComplete;
        xmlHttp.send('');
}


function LoadContentComplete() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById('thecellid').innerHTML = xmlHttp.responseText;
   }
}


function LoadCarContent() {
        xmlHttp = createRequestObject();
        var url="cars.asp";
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadCarContentComplete;
        xmlHttp.send('');
}


function LoadCarContentComplete() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById('carcontentid').innerHTML = xmlHttp.responseText;
   }
}


function LoadButton() {
        xmlHttp = createRequestObject();
        var url="button.asp";
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = LoadButtonComplete;
        xmlHttp.send('');
}


function LoadButtonComplete() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById('buttonid').innerHTML = xmlHttp.responseText;
   }
}



function GetPrice() {

        xmlHttp = createRequestObject();
        var url="price.asp";
        xmlHttp.open('GET', url, true);
        xmlHttp.onreadystatechange = GetPriceComplete;
        xmlHttp.send('');
}


function GetPriceComplete() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
      document.getElementById('newpricehere').innerHTML = xmlHttp.responseText;
   }
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14  
Old Aug 25th, 2006, 14:06
Junior Member
Join Date: Dec 2005
Age: 25
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Form Element has no properties when querying

once again.. ANY feedback will be of benefit to me.. ANY!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote