On Fri, 20 Feb 2004 17:34:28 GMT, AC <AC@No.spam> wrote:
[color=blue]
> 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 on what
> manufacturer the user selects. After "buying" a few products (4-8)
> they user gets the error message: 'QUANTITY.value' is null or not an
> object.
>
> Do you see a workaround/fix for this?[/color]
Nothing that you have posted in this thread, with one (or possibly two)
exceptions, should cause this problem.
[color=blue]
> I posted this on February 19, 2004 under the title 'value is null or not
> an object -- after a few submits' and received some syntax tips. The
> formatting has been applied and I hope someone can offer some
> programmatic help.[/color]
As such, I can do little more at the moment than provide more syntax tips.
Do read them, though.
[snip]
[color=blue]
> <td width='50' valign='middle' align='center'>
> <FORM NAME='frmOrder18ea' action='products3.asp'>
> <input type='hidden' name='ID_NUM' value='18'>
> <input type='hidden' name='NAME' value='Widget A'>
> <input type='hidden' name='PRICE' value='4.4'>
> <font size=-1><input type='text' size='3' name='QUANTITY' value='0'
> onChange='this.value=CKquantity(this.value)'></input> </font>[/color]
There is no such thing as a closing INPUT tag. Get rid of it.
[snip]
[color=blue]
> <td width='53' valign='middle' align='center'>
> <FORM NAME='frmOrder18bx' action='products3.asp'>
> <input type='hidden' name='ID_NUM' value='18'>
> <input type='hidden' name='NAME' value='Widget A big'>
> <input type='hidden' name='PRICE' value='99'>
> <font size=-1><input type='text' size='3' name='QUANTITY'
> value='0'></input> </font>[/color]
The same criticism here as above.
[snip]
[color=blue]
> <FORM NAME='frmSubmitMe18' action='products3.asp'>
> <input type="button" value="Buy" onClick="ProcessBuys(frmOrder18ea,
> frmOrder18bx )">[/color]
This call is likely to fail in browsers besides IE. You should not use
element names as global references. Instead use either,
ProcessBuys(document.frmOrder18ea,document.frmOrde r18bx)
or
ProcessBuys(document.forms['frmOrder18ea'],
document.forms['frmOrder18bx'])
[snip]
[color=blue]
> <script language="JavaScript">[/color]
The type attribute is required. The language attribute is deprecated. Use:
<script type="text/javascript">
[color=blue]
> <!--[/color]
Script hiding is an obsolete practice. Remove the SGML comment delimiters.
[color=blue]
> function ProcessBuys(first, second) { //, second) { //Handles multiple
> items
>
> if(first.QUANTITY.value>0){[/color]
It might be more appropriate to convert the text string, value, into a
number before performing that comparison. I'm not sure off hand how it
will be treated, especially if value contains non-numeric characters.
[snip]
I don't think that the number of forms in the page can cause what is
happening. If it is that, then the browser is broken. Even so, it might be
an idea to do it anyway as it's poor use of HTML.
As I seriously doubt the changes above will yield anything except better
compatibility and a more valid document, you'll have to post more code or
even a URL.
Mike
--
Michael Winter
M.Winter@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)