It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Issue with syntax for a hidden value

Issue with syntax for a hidden value

Postby JCCDEVEL on Mon Apr 28, 2008 6:16 pm

Hi All,

I have been trying to help a friend out(for real! She is a designer and I'm a developer but not very familiar with Javascript)

The situation: she is coming in from another page and is passing a value called "chargetotal" in the url(agree it's probably not the best way but she's not in a position to re-write the whole thing). When on this page, she needs to post some information to a secure bank site. One of the things she needs to send is "chargetotal". She is attempting to do this by taking the value from the url, put it into a hidden form variable and then post it. If she hard codes the value it all works - but it doesn't work with the hidden value so clearly the syntax is all wrong. Here is the page:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Payment Page</title>
</head>


<script type='text/javascript'>
function parseGetVars() {
        var getVars = new Array();
        var qString = unescape(top.location.search.substring(1));
        var pairs = qString.split(/\&/);
        for (var i in pairs) {
                var nameVal = pairs[i].split(/\=/);
                getVars[nameVal[0]] = nameVal[1];
                }
        return getVars;
        }
</script>


<body>


<table width="507" border="0" align="center" bgcolor="#FFFFFF">
  <tr>
    <td height="31"><p align="center"><font color="#660000" size="6"
face="Bookman Old Style">Payment
        Options TEST</font></p></td>
  </tr>
  <tr>
    <td height="358" valign="top" background="images/badge.gif"><div
align="center"><font size="2" face="Geneva, Arial, Helvetica, sans-
serif"><br />


<br />
    </font> </div>
        <table width="715" height="52" border="0">
          <tr>
            <td align="center" width="374" height="48">
                        <form name="form1" method="post" action="https://secure.bANK.net/
lpcentral/servlet/lppay">
    <script type='text/javascript'>
    var g = parseGetVars();
    for (var i in g)
    document.writeln('Your total fee is $' +g[i]+'<br>');
document.forms.form1.FeeCalcTotalDecimal.value  = '+g[i]+' ;
    </script>
                        <input type="hidden" name="txntype" value="sale">
                                <input type="hidden" name="storename" value="1001184858">
                                <INPUT type="hidden" name="chargetotal" value="">
                                <input type="hidden" name="suppressTitle" value="true">
                                <input name="Submit" type="submit" id="Submit" value="Submit">
                                </td>
            <td width="331">
                </div>
            </form></td>
          </tr>
        </table>
      <div align="center"><font size="2" face="Geneva, Arial,
Helvetica, sans-serif">


      </font></div></td>
  </tr>
</table>
</body>
</html>


</CODE>


Realize that this pretty basic stuff for anybody with good knowledge
of Javascript - but that is not us! So, you have our eternal thanks
for your assistance!


[/code]
JCCDEVEL
 
Posts: 0
Joined: Mon Apr 28, 2008 6:00 pm

Who is online

Users browsing this forum: No registered users and 4 guests

cron