Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2004
    Posts
    23
    Thanks
    3
    Thanked 0 Times in 0 Posts

    How to send a JS form total into a hidden input type

    Hello all, I have a problem. I have a JS order form on my website and I need to send the total to my third party credit card processor. My order form script is as follows;

    function CalculateTotals() {
    f=document.orderform;
    f.ssgt.value=parseInt(f.ssg.value)*25;
    f.ssot.value=parseInt(f.sso.value)*25;
    f.sswt.value=parseInt(f.ssw.value)*25;
    f.lsbt.value=parseInt(f.lsb.value)*30;
    f.lswt.value=parseInt(f.lsw.value)*30;
    f.tqbwt.value=parseInt(f.tqbw.value)*30;
    f.tqbgt.value=parseInt(f.tqbg.value)*30;
    f.tqmgt.value=parseInt(f.tqmg.value)*30;
    f.tqblwt.value=parseInt(f.tqblw.value)*30;
    f.out.value=parseInt(f.ou.value)*25;
    f.but.value=parseInt(f.bu.value)*25;
    f.gut.value=parseInt(f.gu.value)*25;
    f.bgwst.value=parseInt(f.bgws.value)*25;
    f.bpwst.value=parseInt(f.bpws.value)*25;
    f.bywst.value=parseInt(f.byws.value)*25;
    f.grandtotal.value=parseInt(f.ssgt.value)
    +parseInt(f.ssot.value)
    +parseInt(f.sswt.value)
    +parseInt(f.lsbt.value)
    +parseInt(f.lswt.value)
    +parseInt(f.tqbwt.value)
    +parseInt(f.tqbgt.value)
    +parseInt(f.tqmgt.value)
    +parseInt(f.tqblwt.value)
    +parseInt(f.out.value)
    +parseInt(f.but.value)
    +parseInt(f.gut.value)
    +parseInt(f.bgwst.value)
    +parseInt(f.bpwst.value)
    +parseInt(f.bywst.value)}

    The html form code supplied by my credit card processor is as follows;

    <form method="POST" action="https://payments.verisign.com.au/payflowlink">
    <input type="hidden" name="LOGIN" value="Your LOGIN here">
    <input type="hidden" name="PARTNER" value="VSA">
    <!-- The transaction AMOUNT must be at least 1.00 -->
    <input type="hidden" name="AMOUNT" value="Total transaction AMOUNT here">
    <input type="hidden" name="TYPE" value="Valid transaction TYPE here">
    <input type="submit" value="Click here to Purchase">
    </form>

    Their code works OK if you have a submit button for every item you want to sell because you just put individual dollar values into the amount value field. I need to know how I can put the grandtotal value from my order form in there instead.
    Any help is much appreciated,
    Thanks.

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Have you tried

    f.AMOUNT.value=f.grandtotal.value


    I just noticed the form code supplied by your credit card processor does not have a name so give that form a name and go

    document.formname.AMOUNT.value=f.grandtotal.value

    where formname is the name of the form supplied by your credit cardprocessor

  • #3
    New Coder
    Join Date
    Jun 2004
    Posts
    23
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Many thanks Mr J, I had a rough idea of what was required but am not familiar enough with the syntax. Followed your advice and it worked just fine but only after I wasted 3 hours and then realised I'd left off 1 set of quotation marks, it's always in the last place you look......
    Thanks again.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •