Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

JavaScript : Add to cart question; validating users choices


westkoast

Recommended Posts

OK here's my problem: We have a tee shirt and it has (4) styles, and (6) sizes.

 

However the first 2 styles are only offered in 3 sizes...

 

So sceneario:

User picks style

User picks size

User pushes submit

 

System needs to check that the style is offered in the size.

 

Function is called by: <a href="#" onclick="verifySizes(this.form);">

 

The java script:

 

function verifySizes(form)

{

style = form.id[1][form.id[1].selectedIndex].value

size = form.id[2][form.id[2].selectedIndex].value

 

if ((size == 1) && (style == 7)) {

alert ('The item you have requested is not available in the selected size / style configuration');

}

 

else{ document.cart_quantity.submit(); }

}

 

 

Basically if size "1" is selected from the pulldown menu, and and style "7" I want to pop an alert box notifying the customer that this style does not exist in this size.

 

For some reason when I push sumbit I get an error:

 

"form has no properties"

 

But I'm passing the form name in.....

 

Any suggestions???

I need to read the rules more often...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...