PDA

View Full Version : Radio button



Lisjachij
06-23-2008, 07:38 AM
Please provide me with step-by-step instructions on how to accomplish the following task. I create two Radio buttons (or option buttons), let say button A and button B and one simple button. Question: how to connect simple button with Radio buttons so that if I select Radio button A I'm redirected to Page 1 and if I select Radio button B I'm redirected to Page 2.

adele1972
06-23-2008, 12:51 PM
Please provide me with step-by-step instructions on how to accomplish the following task. I create two Radio buttons (or option buttons), let say button A and button B and one simple button. Question: how to connect simple button with Radio buttons so that if I select Radio button A I'm redirected to Page 1 and if I select Radio button B I'm redirected to Page 2.
hi
click on button properties, then add the link to button 2
ie www.yoursitename.com/whateveryoucalledthepage.html (http://www.yoursitename.com/whateveryoucalledthepage.html)

link the button to the page you would like it to go to!

Lisjachij
06-24-2008, 07:45 AM
It doesn't answer my question. What should I set in properties of Radio buttons (Group name, Value, Events) to connect it with simple button, so if I choose Radio button 1 and then click simple button I'm redirected to page 1 and if I choose Radio button 2 I'm redirected to page 2

D'son
06-24-2008, 02:55 PM
Place the button where you like, double click the button. When the properties box opens, name the button appropriately, go to the events tab, click add, under the event drop list select "on click", leave the action "show", and type in the full address of the page you want to link too in the target box, click ok. Repeat this for each button.

navaldesign
06-24-2008, 03:36 PM
The only way to do that is with Javascript.
let me explain: the radio buttons, by themselves, and the button, need to be related, and the simplest way to do that is that they are all part of a form.
So your button should be a "Submit" one. You add, in the Inside Tag of the radio buttons html :

"onclick="changeaction()"



Now you should write this simple Javascript (changeaction) that will check the value of the radio buttons and will change the form action accordingly, to send to either page 1 or page 2.

If you look at the code of the Go Menu, you will get some ideas on how this function should be structured.

Lisjachij
06-25-2008, 04:08 PM
Thank you very much for your reply, you seems to be the only one who understand what I want to perform. Could you help me writing this simple javascript? Unfortunately I couldn't solve it by myself.

navaldesign
06-25-2008, 07:39 PM
Ok.

Place the two radio buttons on your form. Call them, in example, "url" . Now, right click the first and paste the following code in the Inside Tag of it's html:

onclick="changeaction1()"

Repeat for the second one, but the code should be:

onclick="changeaction2()"

Now, copy the following code and paste it in the Inside Head Tag of the Page HTML:

<script language="JavaScript" type="text/javascript">
function changeaction1()
{
document.forms[0].action = 'http://www.dbtechnosystems.com' ;
}
function changeaction2()
{
document.forms[0].action = 'http://www.navaldesign.info' ;
}
</script>
You can see, in red, the URLs that i have used in this example, replace them with your own. If you have more than two radio buttons, add code accordingly.


Test it in http://www.dbtechnosystems.com/Tips/change_action.php (http://www.dbtechnosystems.com/Tips/change_action.php)

Lisjachij
06-26-2008, 06:51 PM
Thank you very much! Everything works just great! I had only to change 0 to 1 in javascript code (document.forms[0].action change to document.forms[1].action), because I had another form on the page.

I have another question concerning this second form. The form was created by means of Form Wizard from template Support. I entered my e-mail address into this form but when I preview the page and click Submit I have error: File not found. Firefox can't find the file at /C:/DOCUME~1/MyComputerName/LOCALS~1/Temp/preview/<? echo($_SERVER['PHP_SELF']);?>.

navaldesign
06-26-2008, 08:15 PM
The pages with forms created with the form wizard are php. This means that they will ONLY work (submit) when published, because php doesn't work on your own computer. It will work when published.

Lisjachij
06-27-2008, 04:24 PM
Thank you very much, I just can't bother you any more...

willow315
08-21-2008, 11:03 PM
This is exactly what I want to do, but I don't understand the instructions. When you say, "Place the two radio buttons on your form. Call them, in example, "url" . Now, right click the first and paste the following code in the Inside Tag of it's html:" What do you mean by 'Inside Tag of it's HTML' I see nothing anywhere called, "Inside Tag." What are you talking about? also, What do you set the initial action in the form code to? EG, <form action=""....what should go there?

Here's the code for my simple form: Can you clarify your instructions?

<form action="" method="post" name="PledgeDistrib" id="PledgeDistrib">

<table width="472">
<tr>
<td width="183"><label>
<input name="SupportWUSF" type="radio" id="SupportWUSF_0" value="GiveFM">
<span class="BLKSubhdSmall">GIVE TO WUSF 89.7</span></label></td>
<td width="192"><input type="radio" name="SupportWUSF" value="GiveTV" id="SupportWUSF_1">
<span class="BLKSubhdSmall">GIVE TO WUSF TV/DT</span></td>
<td width="81"><input type="submit" name="Submit" id="Submit" value="Go"></td>
</tr>
</table>
</form>

Thanks, WCW

navaldesign
08-21-2008, 11:11 PM
When you right click a Radio Button, select, from the menu that appears, "HTML". Then you will see the tags. Click on "Inside Tag" and paste the code in the lower window.

However, these instructions are for BV forms, the above is not.