Questions Tags Users Unanswered

radio button form

Question is open.
2 answers (2 voices) (8517 views)
hi,
i have what should be a simple problem, but not being a JS programmer, i'm stuck.

i have a form:

<table width="445px" style="margin:10px 0px 10px 10px;" cellpadding="10px">
<tr>
<td width="183" valign="top" bgcolor="#FFFFFF"><p>I would like to donate:</p></td>
<td width="214" bgcolor="#FFFFFF">
<form id="Donating" name="Donate" method="get" action="" target="_blank" onsubmit="return goTo()">
<label>
<input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=34" id="Donate_0" />
$10</label>
<br />
<label>
<input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=36" id="Donate_1" />
$25</label>
<br />
<label>
<input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=38" id="Donate_2" />
$50</label>
<br />
<label>
<input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=40" id="Donate_3" />
$100</label>
<br />
<label>
<input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=42" id="Donate_4" />
$500</label>
<br />
<label>
<input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=44" id="Donate_5" />
$1,000</label>
<br />
<label>
<input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=46" id="Donate_6" />
$5,000</label>
<br />
<label>
<input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=48" id="Donate_7" />
$10,000</label>
<br /><br />
<input name="submit" type="submit" value="Donate Now" />
</p>
</form>
</td>
</tr>
</table>

once the submit button is clicked, i want to open a new window and for the value of whatever radio button was chosen to be the URL for the new window.

seems pretty straightforward, but i'm stuck. any help would be most appreciated.
2 Answers
sorry for all the repeats...i couldn't tell if my answer was "sending" or not.

lanny
Hi,



1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
    <script>
        function goTo (form) {
            var url = "";
            var radios = form.elements['Donate'];
            for (var i=0; i < radios.length; i++) {
                if (radios[i].checked) {
                    url = radios[i].value;
                    break;
                }
            }
            form.action = url;
        }
    </script>

    <table width="445px" style="margin:10px 0px 10px 10px;" cellpadding="10px">
        <tr>
            <td width="183" valign="top" bgcolor="#ffffff"><p>I would like to donate:</p></td>
            <td width="214" bgcolor="#ffffff">
                <form method="get" action="" target="_blank" onsubmit="return goTo(this)">
                    <input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=34" id="donate_0" />
                    <label for="donate_0">$10</label>
                    <br />
                    <input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=36" id="donate_1" />
                    <label for="donate_1">$25</label>
                    <br />
                    <input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=38" id="donate_2" />
                    <label for="donate_2">$50</label>
                    <br />
                    <input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=40" id="donate_3" />
                    <label for="donate_3">$100</label>
                    <br />
                    <input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=42" id="donate_4" />
                    <label for="donate_4">$500</label>
                    <br />
                    <input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=44" id="donate_5" />
                    <label for="donate_5">$1,000</label>
                    <br />
                    <input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=46" id="donate_6" />
                    <label for="donate_6">$5,000</label>
                    <br />
                    <input type="radio" name="Donate" value="https://wholewoman.infusionsoft.com/app/manageCart/addProduct?productId=48" id="donate_7" />
                    <label for="donate_7">$10,000</label>
                    <br /><br />

                    <input name="submit" type="submit" value="Donate Now" />
                </form>
            </td>
        </tr>   
    </table>
this is awesome! thank you so much. there is one problem, however. while clicking submit does take the viewer to the cart, the ?productID=xx which is added to the url in the value statement for each radio button choice isn't being transferred to the new window and as a result, the cart is not being populated with the appropriate product choice. any thoughts? the actual URL in which the form exists is http://www.wholewoman.com/newpages/savingyourhips/donate.html. again, many thanks for your help! lanny goodman - lanny -
15 30 50 per page

Your Answer

Limit of files to attach: 3 / Max total size: 1024 KB
File:
Description:
remove