Click to See Complete Forum and Search --> : here's one


okham
11-05-2003, 06:57 PM
...okay folx, this one seems pretty straightforward and easy, but I haven't found a solution that works for me...

Basically, I've used javascript to calculate an amount on my webpage...but haven't been successful at passing that return to the "amount" hidden input for a shopping cart. So I've got:

<input type="hidden" name="amount" value=amount()>

function amount() {
amountadded; return;
}


Doesn't seem to work for me. Any suggestions?

Khalid Ali
11-05-2003, 07:59 PM
Originally posted by okham
<input type="hidden" name="amount" value=amount()>


you can not assign value to a textfield like that, here is the possible answer

document.formName.hiddenFieldName.value=GetTotalValue();

and make sure that you trigger some event that will cuase the above line of code to be executed.

okham
11-05-2003, 08:32 PM
...tried that earlier, Khalid, but no dice. But it makes me think (I'm thinking about PayPal here now, and what their server expects)... originally the value is assigned, say..."20.00." It's a number, but in quotes like text. Would I have to convert a number return from a function to make it palletable for their server? How might I do that?

Also, I've seen you post a link here once to some guy on AOL that had a demo on calculating for PayPal, and if you could include that here I might be able to find out how he passes his value.

Thanks. okham