Link to home
Start Free TrialLog in
Avatar of cokefour
cokefourFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Order form blues

Hi Experts,
I am trying to collect information from an order form but only wish to use the information from the form where the quantity ordered is greater than 0 and perform calculations based on that.
I had thought of trying to create an array of each item and selecting only the ones with the qty greater than 0 or creating an object with the needed properties to hold the information from each form.
The page is visible here and if you're firebugging the Javascript is there too. The form in question is the one with the fruit juices.
If there's an easier way than the ones I outlined please let me know.
Merçi
Coke
Avatar of Barry62
Barry62
Flag of United States of America image

Building an array would work fine.

juiceOrderArray = new Array("qtyjuice1", "qtyjuice2","qtyjuice3","qtyjuice4","qtyjuice5","qtyjuice6","qtyjuice7","qtyjuice8","qtyjuice9","qtyjuice10");
for(i=0; i<juiceOrderArray.length; i++) {
        if(juiceOrderArray[i] > 0){
	      "Add to calculation routine".
        }
}

Open in new window

Avatar of cokefour

ASKER

DO you know how I would be able to associate each price and name with its quantity?
ASKER CERTIFIED SOLUTION
Avatar of Barry62
Barry62
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial