473,419 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

value is null or not an object -- after a few submits

AC
This code works great the first few times it is used in a form and then I
get the error:
'QUANTITY.value' is null or not an object in IE6.

The names used are generated on the server so it is not code that changes
due to being handwritten. I can't see any reason why this does work at
first then fails after a few uses. It is weird that it works perfectly but
after a few attempts it stops working.
**THE CALLER:
note there are some hidden fields but they are not used in this code.
====================================
<tr>
<FORM NAME='frmOrder39ea'>
<td width='50' valign='middle' align='center'><font size=-1>
<input type='text' size='3' name='QUANTITY' value='0'
onChange='this.value=CKquantity(this.value)'></input>&nbsp;</font></td>
</FORM>

<FORM NAME='frmOrder39bx'>
<td width='53' valign='middle' align='center'><font size=-1>
<input type='text' size='3' name='QUANTITY'
value='0'></input>&nbsp;</font></td>
</FORM>
<FORM NAME='frmSubmitMe39'>
<td>
<input type="button" value="Buy"
onClick="ProcessBuys(document.forms['frmOrder39ea'],
document.forms['frmOrder39bx'])">
</td>
</FORM>
</tr>
====================================

**THE FUNCTON:
takes the two forms above and then works on them.
The line with the error is commented below.
====================================
function ProcessBuys(first, second) { //, second) { //Handles multiple items

//alert('1p- '+first.PRICE.value+' -1p 2p- '+second.PRICE.value+' -2p
1q- '+first.QUANTITY.value+' -1q 2q-'+second.QUANTITY.value+' -2q' );

if (! first){
alert('first object is null');
return false;
}
else {
if (first.QUANTITY.value!=null){ // <---- ERROR IS ON THIS LINE
if(first.QUANTITY.value>0){
AddToCart(first);
//alert('bye '+first.name+' bye');
}
}
else {
alert('first quantity is null');
}
}

if (second.QUANTITY.value!=null){
if(second.QUANTITY.value>0){
AddToCart(second);
//alert('abt '+first.name+' abt');
}

return false;
}

first=null;
second=null;

return true;
}
====================================
*****************************************
Jul 20 '05 #1
6 6245
"AC" <AC@No.spam> wrote in message
news:hw*******************@nwrdny03.gnilink.net...
<snip>
<tr>
<FORM NAME='frmOrder39ea'>

<snip>

Valid HTML 4 requires (by official DTD) a form element to have an action
attribute and forms may not be children of TR elements. Without starting
with valid HTML there is no reason to expect javascript to be able to
interact successfully with the resulting DOM.

Richard.
Jul 20 '05 #2
AC
So you're saying:

1) I need to have an action for the form. I can do that by creating an
action I won't use.

2) I can't have a form(s) in a table? Do you mean I should use CSS?

Thanks for the info. Could you supply some ideas about what I should change
the code to?
-AC

"Richard Cornford" <Ri*****@litotes.demon.co.uk> wrote in message
news:c1*******************@news.demon.co.uk...
"AC" <AC@No.spam> wrote in message
news:hw*******************@nwrdny03.gnilink.net...
<snip>
<tr>
<FORM NAME='frmOrder39ea'>

<snip>

Valid HTML 4 requires (by official DTD) a form element to have an action
attribute and forms may not be children of TR elements. Without starting
with valid HTML there is no reason to expect javascript to be able to
interact successfully with the resulting DOM.

Richard.

Jul 20 '05 #3
> 2) I can't have a form(s) in a table? Do you mean I should use CSS?

Thanks for the info. Could you supply some ideas about what I should change
the code to?


I believe the poster is saying that you need to construct a proper table:

Data is in <td> tags not <tr> tags. Try:

<tr>
<td width='50' valign='middle' align='center'>
<FORM NAME='frmOrder39ea'>
....
<form>
</td>
</tr>

I not sure how reliable the font tag is across tables.

Robert
Jul 20 '05 #4
AC
I updated the pages to be HTML 4 compliant as far as I know it did nothing
to help.

Reposting this with the new compliant code and hoping someone can solve
this.

-AC

"Robert" <rc*******@my-deja.com> wrote in message
news:c6**************************@posting.google.c om...
2) I can't have a form(s) in a table? Do you mean I should use CSS?

Thanks for the info. Could you supply some ideas about what I should change the code to?


I believe the poster is saying that you need to construct a proper table:

Data is in <td> tags not <tr> tags. Try:

<tr>
<td width='50' valign='middle' align='center'>
<FORM NAME='frmOrder39ea'>
...
<form>
</td>
</tr>

I not sure how reliable the font tag is across tables.

Robert

Jul 20 '05 #5
> ====================================
<tr>
<FORM NAME='frmOrder39ea'>
<td width='50' valign='middle' align='center'><font size=-1>
<input type='text' size='3' name='QUANTITY' value='0'
onChange='this.value=CKquantity(this.value)'></input>&nbsp;</font></td>
</FORM>

<FORM NAME='frmOrder39bx'>
<td width='53' valign='middle' align='center'><font size=-1>
<input type='text' size='3' name='QUANTITY'
value='0'></input>&nbsp;</font></td>
</FORM>
<FORM NAME='frmSubmitMe39'>
<td>
<input type="button" value="Buy"
onClick="ProcessBuys(document.forms['frmOrder39ea'],
document.forms['frmOrder39bx'])">
</td>
</FORM>
</tr>


I hadn't look at this carefully before but you realize that you have
three forms here?

Each form requires an action tag that I do not see. I assume that
each form requires a button. I assume the three forms should be one.

I suggest reviewing the html input source. Find an expert on HTML.

You may want to take a look at:
http://tidy.sourceforge.net/

Robert
Jul 20 '05 #6
AC
"Robert" <rc*******@my-deja.com> wrote in message
news:c6**************************@posting.google.c om...
====================================
<snip/>
I hadn't look at this carefully before but you realize that you have
three forms here?

Each form requires an action tag that I do not see. I assume that
each form requires a button. I assume the three forms should be one.

I suggest reviewing the html input source. Find an expert on HTML.

You may want to take a look at:
http://tidy.sourceforge.net/

Robert


Thank you for your replies.

Yes I know. I am using an application called NOPcart v4.2.2
(http://www.nopdesign.com/freecart) for the base and then I modified it a
bit. So I really have 3 forms per product. Which means up to about 150
forms per page :)

I have created a new post "value is null or not an object -- after
submitting a few times" with the cleaned up code. I didn't think this
thread would get any more attention :(

I will look at Tidy.

Thanks,
-AC
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Robert Mark Bram | last post by:
Hi All! I have the following code in an asp page whose language tag is: <%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%> // Find request variables. var edition = Request.Form ("edition"); var...
8
by: AC | last post by:
I hope someone can tell me why this is not working. I have a form that dynamically creates the code below. This is for one product and there are about 10 to 50 products that are listed depending...
21
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
5
by: cmc_dermo | last post by:
I have a form that has a select list. A user chooses a value and the page refreshes showing the selected value in the dropdown box. So I want to use Javascript to get the selected query from...
16
by: sneill | last post by:
How is it possible to take the value of a variable (in this case, MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name? In the following example I want 'oIcon' object to have...
4
by: John Vottero | last post by:
When a class contains a TimeSpan property, XmlSerializer doesn't work. A TimeSpan property is serialized like: <MySpan /> I've read a number of posts that talk about why this happens and how...
6
by: David N | last post by:
Hi All, What is a best way to handle an undefined value object class that returned from a function. I have a function that call the ADO.NET ExecuteScalar() function and returns the object to...
5
by: Jake G | last post by:
I have a flash word verification doohickey running on a page that submits an email (problem with a spammer). The code for the flash is...... <td width="109"<div id="flashcontent"> <object...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.