Why will the following HTML and Javascript not work in form

F

Frank H. Shaw

The following HTML markup and Javascript not work or does not seem to work in
this form when testing on the website the paypal does not see any items
ordered the default is 1 item ordered but nothing has been sent to paypal
data and information missing.

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="(e-mail address removed)">
<input type="hidden" name="item_name" value="Pro Style ATF Ankle Brace with
Universal Fit">
<script type="text/javascript">
if (R1[0].checked)
{
<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">
}
else
{
<input type="hidden" name="item_number" value="212-D">
<input type="hidden" name="amount" value="225.00">
}
</script>
<input type="hidden" name="return"
value="http://www.skolsportsshop.com/success.htm">
<input type="hidden" name="cancel_return"
value="http://www.skolsportsshop.com/cancel.htm">
<input type="hidden" name="currency_code" value="USD">
<input TYPE="image" SRC="https://www.paypal.com/images/sc-but-03.gif"
NAME="submit0"alt="Make payments with PayPal - it's fast, free and secure!"
width="124" height="26">
<input type="hidden" name="add" value="1">
</form>
 
J

Jens Peter Karlsen[FP-MVP]

See inline.

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="(e-mail address removed)">
<input type="hidden" name="item_name" value="Pro Style ATF Ankle Brace with
Universal Fit">
<script type="text/javascript">
if (R1[0].checked)
{
<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">

Like I wrote earlier. it is invalid to have HTML here.
}
else
{
<input type="hidden" name="item_number" value="212-D">
<input type="hidden" name="amount" value="225.00">

Same goes here.
}
</script>

Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 
R

Ronx

The radio button R1 must be in the same form, or it must be a separate
form on the same page. If separate:

<form name="ABUFR">
<input type="radio" name="R1"
onclick="document.forms['ABUF'].item_number.value='212-D';document.forms['ABUF'].amount.value='225.00';">
By Dozen
<input type="radio" name="R1"
onclick="document.forms['ABUF'].item_number.value='212-E';document.forms['ABUF'].amount.value='20.95'"
checked> By Each
</form>

There is no need for a submit button, or action for this form.

As has been said before, you cannot mix HTML and JavaScript in the
fashion in your code snippet.

Give the PayPal form a unique name, which is referred to in the form
above.
Example:
<form name="ABUF" target="paypal"
action="https://www.paypal.com/cgi-bin/webscr" method="post">

The rest of the code change to:

<input type="text" name="item_number" value="212-E">
<input type="text" name="amount" value="20.95">
<input type="hidden" name="return"
value="http://www.skolsportsshop.com/success.htm">
<input type="hidden" name="cancel_return"
value="http://www.skolsportsshop.com/cancel.htm">
<input type="hidden" name="currency_code" value="USD">
<input TYPE="image" SRC="https://www.paypal.com/images/sc-but-03.gif"
NAME="submit0"alt="Make payments with PayPal - it's fast, free and
secure!"
width="124" height="26">
<input type="hidden" name="add" value="1">
</form>

A working example of this is at
http://www.rxs-enterprises.org/tests/pages/prices2.htm
change the text boxes into hidden fields.
--
Ron Symonds
Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

Frank H. Shaw said:
The following HTML markup and Javascript not work or does not seem
to work in
this form when testing on the website the paypal does not see any
items
ordered the default is 1 item ordered but nothing has been sent to
paypal
data and information missing.

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business"
value="(e-mail address removed)">
<input type="hidden" name="item_name" value="Pro Style ATF Ankle
Brace with
Universal Fit">
<script type="text/javascript">
if (R1[0].checked)
{
<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">
}
else
{
<input type="hidden" name="item_number" value="212-D">
<input type="hidden" name="amount" value="225.00">
}
</script>
<input type="hidden" name="return"
value="http://www.skolsportsshop.com/success.htm">
<input type="hidden" name="cancel_return"
value="http://www.skolsportsshop.com/cancel.htm">
<input type="hidden" name="currency_code" value="USD">
<input TYPE="image"
SRC="https://www.paypal.com/images/sc-but-03.gif"
NAME="submit0"alt="Make payments with PayPal - it's fast, free and
secure!"
width="124" height="26">
<input type="hidden" name="add" value="1">
</form>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top