- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Changing Javascript Variable with Form
Hey Guys,
I’ve been working on a little something :)
I’ve been trying to use this shopping cart called simpleCart(js) its a javascript based shopping cart and I am stuck on just 1 thing. the shipping!
Anyway the variable that controls the flatrate shipping for the cart is
simpleCart.shippingFlatRate
however I want the user to have a choice, to choose what shipping they want. so here is my code for the form.
I set it that when the user chooses an option it updates the variable and that is then passed into the flat shipping variable on the simpleCart(js) script however when I do this it always detect teh shipping as 0.00
Please help me out! Any help will be greatly appreciated.
Thank You
its ok guys I figured it out :)
so, how did you figured it out?
I’m stuck in the same part…
Any hint would be appreciated.
So the solution for me was really simple, you have to add at the end of the onchange script the Simplecart function: simpleCart.update();
here is the script I made with lots of cut and paste from other places:
function populateApplication(){
var edNum = document.getElementById(“shippingChoice”).selectedIndex;
var edValue = document.getElementById(“shippingChoice”).options[edNum].value;
simpleCart.shippingFlatRate = edValue;
simpleCart.update();
}
And here is the HTML:
And the Paypal order worked fine…