Click to See Complete Forum and Search --> : forms value
Marlbil
11-12-2003, 12:11 PM
I want to use verisign to process my charge card payments. I'm testing before I comit to the service so no tech support. I'm using javascript to calculate the values in my form. What is submitted to verisign is:
<FORM METHOD="POST" ACTION = "https://payflowlink.verisign.com/payflowlink.cfm" >
<input type="hidden" name="LOGIN" value="marlbil">
<input type="hidden" name="PARTNER" value="verisign">
<input type="hidden" name="AMOUNT" value="23.67">
<input type="hidden" name="TYPE" value="S">
If I use my HTML editor and type in the amount (23.67 as above) it works fine after I save it and open the form. But I can't figure out the coding necessary to provide the amount using my calculated fields. In other words how do I replace the value amount with a field calculated in my script.... thanx
gil davis
11-12-2003, 12:26 PM
First off, give your form a name:
<FORM name="f1" ...>
Then, after you have calculated the amount:
document.f1.AMOUNT.value = theNewAmount;
Marlbil
11-12-2003, 01:20 PM
First, thanx for helping Gil!
we're not on the same page. The form is working fine but I need to get the value of document.orders.totalAmt into this statement as a value for AMOUNT.
<input type="hidden" name="AMOUNT" value="0">
tHE ABOVE STATEMENT REQUIRES VALUE TO BE ENTERED AS A LITERAL. i NEED TO BE ABLE TO ENTER A VARIABLE BECAUSE THE AMOUNT OF EACH AND EVERY ORDER CHANGES. cONSEQUENTLY i NEED THE ORDER AMOUNT FROM MY FORM TO BE THE VALUE OF THE AMOUNT IN THE FORM COMMAND.
gil davis
11-12-2003, 01:48 PM
Well, you see, we really aren't on *any* page because you didn't post enough information in the first place. ;)
My answer assumed (definition: it makes an ASS out of U and ME) that you were calculating the total amount somewhere in a script, and you were trying to transfer that calculated amount and place it in a form meant only for the Verisign place.
So now you are apparently telling me that there are two forms on your page - one called "orders" and one with no name that goes to Verisign.
If you could give us more to work with (like a link to your page or attach the file as text or zip to your next post), the quality of our answers is bound to increase.
<input type="hidden" name="AMOUNT" value="0">
tHE ABOVE STATEMENT REQUIRES VALUE TO BE ENTERED AS A LITERAL. i NEED TO BE ABLE TO ENTER A VARIABLE BECAUSE THE AMOUNT OF EACH AND EVERY ORDER CHANGES. cONSEQUENTLY i NEED THE ORDER AMOUNT FROM MY FORM TO BE THE VALUE OF THE AMOUNT IN THE FORM COMMAND.There is no way to place a variable in the HTML code. You either dynamically create the form element at runtime using the desired variable (client side or server side) or you use javascript and change the VALUE attribute prior to submitting the form (this is the method I was referring to in my previous post).
In reality, the INPUT element is already a variable. When you include the VALUE= parameter, it just specifies the default (or initial) value of the field.
Marlbil
11-12-2003, 02:57 PM
I'll give the link so the view source is readable. I removed form method that emailed the form to me and replaced it with verisigns form function.
The other thing I did concerns the field named "AMOUNT"
http://www.marlbil.com/PayflowTest.html
THANX
gil davis
11-12-2003, 03:18 PM
This is the line I was trying to get out of you:
document.forms[0].total.value= ("$" + (total));
I would think that this is the quantity that you want to report as the "AMOUNT" for the Verisign people. Assuming they don't need the "$":
document.forms[0].AMOUNT[0].value= total;
right after the code quoted above.
Your form has two elements named AMOUNT. That is why I added "[0]" to the element (one is a text box and the other is hidden). If you really wanted only one AMOUNT box, eliminate the second one and then use
document.forms[0].AMOUNT.value= total;instead.
Marlbil
11-12-2003, 04:37 PM
Gil, that worked. I did have to make one change. AMOUNT was hidden and I needed to change it to text for it to work.
Thanks a bunch Gil, your really appreciated.
Bill