Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

add to script below

Posted on 2005-03-19
6
Medium Priority
?
292 Views
Last Modified: 2010-04-06
I have the following script on my site for e commerce purposes.  If it would help you to see it you can goto www.heavenscentwaxcreations.com/store.htm

What I need is to add a space on there that will give the person the option to type in a certificate number.  Right now all I have are drop down menus with pretyped text in them.  

Here is the code below:

<head>
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
</head>
<head>
<script type="text/javascript">

function Dollar (val) {  
var str,pos,rnd=0;
  if (val < .995) rnd = 1;  
  str = escape (val*1.0 + 0.005001 + rnd);  
  pos = str.indexOf (".");
  if (pos > 0) str = str.substring (rnd, pos + 3);
  return str;
}

function ReadForm (obj1) {
var i,amt,des,obj,pos,val;
  amt = obj1.baseamt.value*1.0;      
  des = obj1.basedes.value;          
  for (i=0; i<obj1.length; i++) {    
    obj = obj1.elements[i];          
    if (obj.type == "select-one" && 
        obj.name == "") {            
      pos = obj.selectedIndex;        
      val = obj.options[pos].value;  
      pos  = val.indexOf ("@");      
      if (pos > 0) amt = val.substring (pos + 1)*1.0;
      pos  = val.indexOf ("+");      
      if (pos > 0) amt = amt + val.substring (pos + 1)*1.0;
      pos  = val.indexOf ("%");      
      if (pos > 0) amt = amt + (amt * val.substring (pos + 1)/100.0);
      if (des.length == 0) des = val;
      else des = des + ", " + val;    
    }
  }
  obj1.item_name.value = des;
  obj1.amount.value = Dollar (amt);
  if (obj1.tot) obj1.tot.value = "$" + Dollar (amt);
}

</script>
</head>



<body>
  <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
                                <p>
                                  <input type="hidden" name="cmd" value="_cart">
                                    <input type="hidden" name="business" value="sheila@heavenscentwaxcreations.com">
                                    <input type="hidden" name="item_name" value="">
                                    <input type="hidden" name="amount" value="">
                                    <input type="hidden" name="return" value="http://www.heavenscentwaxcreations.com/thanks.htm">
                                    <input type="hidden" name="no_note" value="1">
                                    <input type="hidden" name="currency_code" value="USD">
                                    <input type="hidden" name="lc" value="US">
                                    <input type="hidden" name="add" value="1">
                                    <input type="hidden" name="baseamt" value="0.00" />
                                    <input type="hidden" name="basedes" value="Boy Pajama Pals" />
                                    <br />
                                    &nbsp; &nbsp;
                                    <select onchange = "ReadForm (this.form);">
                                      <option value="">Select Scent</option>
                                                               
                                     
<option value="Apple Cinnamon +13.50">Apple Cinnamon</option>
<option value="Baby Powder +13.50">Baby Powder</option>

                                   
                                    </select>
                                    <br />
                                    <br />
                                    Quantity
                                    <input type="text" name="quantity" size="3" value="1" />
                                  </p>
                                 
                                <p>Each&gt;
                                  <input type="text" name="tot" size="8" value="$0.00" />
                                  </p>
                                  <p>
                                    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif"
border="0" name="submit3" alt="Make payments with PayPal - it's fast, free and secure!">
                                  </p>
                             
                              </form>


                        <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
                                <div align="center"> </div>
                        </form>
                                                
                              </td>
                          </tr><tr>
                            <td width="182" valign="top" align="center" height="474">
                              <TABLE cellpadding="0" cellspacing="0" border="1" bordercolor="#003300" style="border-collapse: collapse" width="164" height="260">
                                <tr>
                                  <td height="283">
                                    <div align="center">
                                      <p><img src="picts/Girl%20Pajama%20Pals%207%5B1%5D%5B1%5D.5%20inches%20sitting.jpg" width="132" height="180"></p>
                                      <p>Girl Pajama Pals 7.5 inches sitting.
                                        Comes in color shown.</p>
                                    </div>
                                  </td></tr></table>
</body>
0
Comment
Question by:brycol24
  • 3
  • 3
6 Comments
 
LVL 32

Expert Comment

by:Batalf
ID: 13582903
You just need a new text field?

<head>
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<head>
<script type="text/javascript">

function Dollar (val) {  
var str,pos,rnd=0;
if (val < .995) rnd = 1;  
str = escape (val*1.0 + 0.005001 + rnd);  
pos = str.indexOf (".");
if (pos > 0) str = str.substring (rnd, pos + 3);
return str;
}

function ReadForm (obj1) {
var i,amt,des,obj,pos,val;
amt = obj1.baseamt.value*1.0;      
des = obj1.basedes.value;          
for (i=0; i<obj1.length; i++) {    
obj = obj1.elements[i];          
if (obj.type == "select-one" && 
obj.name == "") {            
pos = obj.selectedIndex;        
val = obj.options[pos].value;  
pos  = val.indexOf ("@");      
if (pos > 0) amt = val.substring (pos + 1)*1.0;
pos  = val.indexOf ("+");      
if (pos > 0) amt = amt + val.substring (pos + 1)*1.0;
pos  = val.indexOf ("%");      
if (pos > 0) amt = amt + (amt * val.substring (pos + 1)/100.0);
if (des.length == 0) des = val;
else des = des + ", " + val;    
}
}
obj1.item_name.value = des;
obj1.amount.value = Dollar (amt);
if (obj1.tot) obj1.tot.value = "$" + Dollar (amt);
}

</script>
</head>



<body>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<p>
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="sheila@heavenscentwaxcreations.com">
<input type="hidden" name="item_name" value="">
<input type="hidden" name="amount" value="">
<input type="hidden" name="return" value="http://www.heavenscentwaxcreations.com/thanks.htm">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="add" value="1">
<input type="hidden" name="baseamt" value="0.00" />
<input type="hidden" name="basedes" value="Boy Pajama Pals" />
<br>
<table border="0">
<tr><td colspan="2">
<select onchange = "ReadForm (this.form);">
<option value="">Select Scent</option>
<option value="Apple Cinnamon +13.50">Apple Cinnamon</option>
<option value="Baby Powder +13.50">Baby Powder</option>
</select>
</td><tr>
<td>Quantity </td>
<td><input type="text" name="quantity" size="3" value="1" /></td>
</tr>
<tr>
<td><p>Each&gt; </td>
<td><input type="text" name="tot" size="8" value="$0.00" /></TD></TR>
<TR>
<TD><p>Certificate </TD>
<TD><input type="text" name="certificateNo" size="20" value="" /></TD>
</TR>
</TABLE>
<p>
<input type="image" src="http://www.heavenscentwaxcreations.com/https://www.paypal.com/en_US/i/btn/x-click-but22.gif"
border="0" name="submit3" alt="Make payments with PayPal - it's fast, free and secure!">
</p>

</form>


<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<div align="center"> </div>
</form>

</td>
</tr><tr>
<td width="182" valign="top" align="center" height="474">
<TABLE cellpadding="0" cellspacing="0" border="1" bordercolor="#003300" style="border-collapse: collapse" width="164" height="260">
<tr>
<td height="283">
<div align="center">
<p><img src="http://www.heavenscentwaxcreations.com/picts/Girl%20Pajama%20Pals%207%5B1%5D%5B1%5D.5%20inches%20sitting.jpg" width="132" height="180"></p>
<p>Girl Pajama Pals 7.5 inches sitting.
Comes in color shown.</p>
</div>
</td></tr></table>
</body>
0
 

Author Comment

by:brycol24
ID: 13583586
I tried that and it will not read it.  Everything showes up on the pay pal shopping cart but that....Does something have to be done in the script at the top?
0
 
LVL 32

Expert Comment

by:Batalf
ID: 13583607
Does the paypal documentation specify anything regarding the name of such form fields?

The form field is posted, but the name "certificateNo" doesn't meet the requirements from paypal.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:brycol24
ID: 13583619
So does that mean I'm out of luck or can it still be done...If it can be done then can you help with it?  Thanks a million.

Brian
0
 

Author Comment

by:brycol24
ID: 13583630
all the script above or most of it above is not paypals that i am aware of.  

just thought that might have some effect on this.

bry
0
 
LVL 32

Accepted Solution

by:
Batalf earned 2000 total points
ID: 13583649
Maybe you could rename the field to "custom".

i.e. change

<input type="text" name="certificateNo" size="20" value="" />

to

<input type="text" name="custom" size="20" value="" />

Check the documentation here:
http://www.paypal.com/cgi-bin/webscr?cmd=_pdn_howto_checkout_outside
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question