Javascript need to run with a Onchange event - radiobutton selecte

F

Frank H. Shaw

My problem is the input items useing hidden fields must conform to what
paypal wants so the form at the bottom of the message I have removed most of
the required HTML for paypal and left only the required HTML not for
explainion and clarity sakes of the following:

In my form code which is not code but HTML markup within the form the input
type hidden two lines i am concerd about happen before the submit button code
The IF ELSE ENDIF logic is around thuose two lines and the two changed lines
which are in the code before the submit button in the code - the IF ELSE
ENDIF logic is inside javascript and is part of the javascript do I need to
have the javacode script happen with a onchange event refering to the
radiobuttons when a user selects either one - How would I get the javascript
to happen onchange event and could someone give me a example of how it would
look to do that type of thing:

Note: The radiobutton HTML happens well before the form code so the
radiobutton HTML can not be part of the form being used to send data to
paypal its self but is still in the body section and is a cell in a table.

To make javascript "fire" due to an "event" contained within a form you need
to use an onchange or onselect event. - I think I would like to use the
onchange event and not the onselect event for my purposes.
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr"
method="post">
<input type="hidden" name="item_number" value="212-E">
<input type="hidden" name="amount" value="20.95">
NAME="submit0"alt="Make payments with PayPal - it's fast, free and secure!"
width="124" height="26">

THANKS
 
M

MD Websunlimited

Frank,

First, PayPal does not care if the fields are hidden or not. It only requires that you send it the required key / value pairs.

To change the value of a hidden form field from a onchange (assuming a select tag) the code would be.

<select name="item1" onchange="if (this.selectedIndex > 0 ) { this.form.hidden1.value = this.options[this.selectedIndex].value } " >

If you have radio buttons in one form on the page and the form to PayPal below it and wish to change a field in the PayPal form then
you need to know the name of the PayPal form.

<input type="radio" name="color" value="Red" onclick="document.form2.item1.value = this.value" >
 

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