Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 29th, 2004, 04:46 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 451
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Ben Horne
Default weddingQty is not defined

Hi all,

For some reason, I cannot get one of the forms on a page I am doing as a class assignment to work. I've gotten most of the Javascript to work ok with no problems but this little problem is driving me nuts.

Here's the code:

Code:
  function wedPrice(myform) {
              var weddingQty = myform.WedQty.value
              var EstPrice = weddingQty * document.WeddingPrice.Price.value.substring(1,6)
              var EstPrice = new String(EstPrice)
              document.WeddingQuantity.WedExtPrice.value = dollarFormat(EstPrice)
          }
The error I get when testing with Mozilla Firefox is this: weddingQty is not defined.

Ben Horne
-------------------------
I don't want to sound like I haven't made any mistakes. I'm confident I have.

Most likely using FireFox and concocting my next Macromedia Flash project
Snibworks Forums Moderator

Welcome to the New Age
__________________
Ben Horne
-------------------------
I don\'t want to sound like I haven\'t made any mistakes. I\'m confident I have.

Most likely using FireFox and concocting my next Macromedia Flash project
Snibworks Forums Moderator

Welcome to the New Age
 
Old November 29th, 2004, 05:08 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 451
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Ben Horne
Default

After some experimentation with ideas I had in my head, I found out the the textbook I'm using has weddingQty confused with WeddingQuantity.

So basically, changing

Code:
var weddingQty = myform.WedQty.value
var EstPrice = weddingQty * document.WeddingPrice.Price.value.substring(1,6)

to



Code:
var WeddingQuantity = myform.WedQty.value
var EstPrice = WeddingQuantity * document.WeddingPrice.Price.value.substring(1,6)

works without any problems

Ben Horne
-------------------------
I don't want to sound like I haven't made any mistakes. I'm confident I have.

Most likely using FireFox and concocting my next Macromedia Flash project
Snibworks Forums Moderator

Welcome to the New Age
 
Old November 29th, 2004, 05:09 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Apparently you're setting weddingQty to an undefined value.

Make absolutely sure that myform.WedQty.value is defined and does not return undefined.

-Snib - http://www.snibworks.com
Where will you be in 100 years?
 
Old November 29th, 2004, 09:46 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 451
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Ben Horne
Default

I know. That's why I played around with it until I got something that would work out.

Ben Horne
-------------------------
I don't want to sound like I haven't made any mistakes. I'm confident I have.

Most likely using FireFox and concocting my next Macromedia Flash project
Snibworks Forums Moderator

Welcome to the New Age





Similar Threads
Thread Thread Starter Forum Replies Last Post
ADODB.Connection user-defined type not defined Wall st Guru Excel VBA 2 March 26th, 2014 03:44 PM
Appl-defined or Object-defined error 1004 chp Excel VBA 3 April 4th, 2006 08:12 AM
User-defined type not defined (Icecream.mdb) dloren01 BOOK: Beginning Access VBA 0 June 22nd, 2005 10:36 PM
...not defined Adam H-W Javascript 2 October 28th, 2004 09:18 AM
Application-defined or object-defined error James Excel VBA 1 August 12th, 2003 11:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.