checking listbox or values

listbox having value1 or value2 or value3 ect

Page 1 of 1

1 Replies - 352 Views - Last Post: 12 March 2009 - 04:22 AM

#1 XMEGA  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 135
  • Joined: 17-November 08

checking listbox or values

Post icon  Posted 11 March 2009 - 07:02 PM

I am checking a form with validations...if the form is filled then only should a popup alert with prices occur however if the form is blank and I hit submit the price alert occurs when it shouldn't...The "priceFinal" is zero inless the form starts getting filled out. The problem I believe is in the listbox its not checking the ORs correctly if I keep just 1 province then it works fine however I have 2 sistuations calucations for Alberta, BC, Manitoba, Ontario, SAS are 1 and another for Quebec.

		if (priceFinal > 0 && document.orderForm.provinceList.value == "Alberta"|| "BC" || "Manitoba" || "Ontario" || "Saskatchewan")
		{
			priceTaxFinal = (priceFinal * Tax) + priceFinal
			alert("Price with Tax: $"+ priceTaxFinal)
		}



Is This A Good Question/Topic? 0
  • +

Replies To: checking listbox or values

#2 roudard  Icon User is offline

  • D.I.C Head

Reputation: 17
  • View blog
  • Posts: 143
  • Joined: 26-September 05

Re: checking listbox or values

Posted 12 March 2009 - 04:22 AM

hey, i'm not entirely sure but i would write this :
document.orderForm.provinceList.value == "Alberta"|| "BC" || "Manitoba" || "Ontario" || "Saskatchewan"


like this :

(document.orderForm.provinceList.value == "Alberta"||document.orderForm.provinceList.value == "BC" ||document.orderForm.provinceList.value == "Manitoba" ||document.orderForm.provinceList.value == "Ontario" ||document.orderForm.provinceList.value == "Saskatchewan")



in the if statement ... maybe even assign document.orderForm.provinceList.value to a variable and type less :P

Let me know if I'm wrong
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1