I�ve got an HTML page created in Dreamweaver that is designed to put a certain size t-shirt into a Shopping Cart (cart.php) via a form � where the user selects the shirt size from a List/Menu, and then hits an �add to cart� image to fire the form and send its parameters to the cart. Here is a URL to a bare-bones page that demonstrates the problem (with a debug popup that echos the product name):
The relevant portions of the code are shown beneath my signature. Any suggestions? Your help is GREATLY appreciated!
[ July 07, 2008: Message edited by: Greg Smith ]
[ July 07, 2008: Message edited by: Greg Smith ] [ July 07, 2008: Message edited by: Greg Smith ]
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along. Please read this for more information.
You can go back and change your post to add code tags by clicking the .
Loading your page into Firefox with Firebug enabled immediately shows your problem. (Your reference to the form is invalid).
Joined: Jul 07, 2008
Here is a much more simplified demo and explanation of what I�m trying to do � and also what else I learned myself last night. Using Firebug helped me at least figure out WHERE the problem is - but I still am stumped as to how to fix it. [I do have it work in IE6 and IE7, but not in FF or Safari]
I stripped pretty much everything out of yesterday�s code last night, and placed at the new URL below what I have left that demonstrates the problem:
There are just two test cases to know that this works:
Test Case 1 � Accepting List/Menu default = Large size shirt 0) Clear your browser cache; make sure pop-ups are enabled in your browser 1) Call up the page http://www.missioninland.com/simple_demo.html 2) You should immediately see (and do see in IE6 and IE7) the first (forced) call to the get_selected_productname1() function cause a pop-up to occur with the default shirt size �SEU-L� to be displayed to you. Hit �Okay� on the pop-up to continue. 3) Do not touch the List/Menu (which means you accept the default size = Large), and only hit the �add to cart� button. 4) a) In IE6 and IE7, what you see next is that the Large Shirt (SEU-L) is correctly added to the shopping cart � and you are redirected to the shopping cart page that shows it actually added. This means success. 4) b) In Firefox and Safari, something goes wrong (see Firebug results below). You never see the pop-up from 2) above, and when you hit the �add to cart� button � it does not successfully pass the form parameters to the cart � which you know because the cart says �Sorry � Your shopping cart is empty�.
Test Case 2 � Changing List/Menu to a different size shirt 5) Clear your browser cache; make sure pop-ups are enabled in your browser 6) Call up the page http://www.missioninland.com/simple_demo.html 7) You should immediately see (and do see in IE6 and IE7) the first (forced) call to the get_selected_productname1() function cause a pop-up to occur with the default shirt size �SEU-L� to be displayed to you. Hit �Okay� on the pop-up to continue. 8) This time change the value of the List/Menu to something like �Medium�. You immediately notice (in IE6 and IE7) that the pop-up box echoes the new shirt name (SEU-M) � hit okay on the pop-up, then hit the �add to cart� button. 9) a) In IE6 and IE7, what you see next is that the selected shirt (Medium in this case) is correctly added to the shopping cart � and you are redirected to the shopping cart page that shows it actually added. This means success. 9) b) In Firefox and Safari, again something goes wrong (see Firebug results below). You never see either of the pop-ups, and when you hit the �add to cart� button � it does not successfully pass the form parameters to the cart � which you know because the cart says �Sorry � Your shopping cart is empty�.
Debug Results from Firebug So the problem is that everything works fine in IE6 and IE7, but does not work at all in Firefox and Safari. I installed Firebug into Firefox, and the error it gives me is that
Document.form1 has no properties
And it points me to this line of code on line 9.
var x = document.form1.finalsize.selectedIndex;
I�ve been staring at this for a while, and I cannot figure out how to fix this. If you or anyone has any ideas, I would be exceptionally grateful � as I�m completely stumped. Thanks in advance!
Eric [ July 08, 2008: Message edited by: Eric Pascarello ]
Joined: Jul 07, 2008
Changing "SE-U" to "form1" works 100% - THANK YOU for pointing out where I was going wrong!!! It is amazing what a fresh pair of eyeballs can do for a problem ... it seems very obvious to me now. Thanks again! Here is what the fix looks like: