Wordpress Themes - Insurance Articles Directory - Kamala Harris - Debt Consolidation - Discount Perfume

PDA

View Full Version : passing data using multiple form styles


lz300
Feb 16th 2007, 8:17 pm
I have a page in which I successfully pass code from a list form to another page via a query string. I now wish to add an additional form (or within the same form) that uses radio buttons, and have its value pass along with the list value. The problem I have is capturing the value of the radio button selection into a variable that can be added to the query string.

- The radio button will default to one choice, and if not changed, I wish it to pass the default value.

- I don't know if it is possible...I would like the code to pass when a list item is selected, OR if a list item is already selected and then the radio button is changed. If this is not possible, then I would be happy with just the list item triggering the new page. I want to do this without the use of a SUBMIT button.

Any ideas on this?

Here is my code:

Sender.html
<html>
<head>
<title>Sender</title>
<script>
function alpha(form)
{
var URL = form.site.options[form.site.selectedIndex].value;
if (URL == "void")
window.parent.self.status="Please choose a video";
else
{
var page2 = "receiver.html?" + URL;
window.location = page2;
}
}
</script>
</head>
<body>
<form name=beta>
Select the size:
<INPUT TYPE="RADIO" NAME="vidsize" VALUE="sm"> Small
<INPUT TYPE="RADIO" NAME="vidsize" VALUE="lg" CHECKED> Large
<select name=site SIZE=6 onChange="alpha(this.form)">
<option selected value="void"> Choose a video... </option>
<option value="First Video"> Video One </option>
<option value="Second Video"> Video Two </option>
<option value="Third Video"> Video Three </option>
</select>
</form>
</body>
</html>


receiver.html
<html>
<head><title>Receiver</title></head>
<body>
<script>
var query = window.location.search;
// SkipS the leading ?
if (query.substring(0, 1) == '?')
query = query.substring(1);
var data = query.split(',');
for (i = 0; (i < data.length); i++)
data = unescape(data);
document.write("data[0] = " + data[0] + "<br>");
document.write("data[1] = " + data[1] + "<br>");
document.write("data[2] = " + data[2] + "<br>");
document.write("data[3] = " + data[3] + "<br>");
</script>
</body>
</html>

Logic Ali
Feb 18th 2007, 7:13 am
- The radio button will default to one choice, and if not changed, I wish it to pass the default value.

- I don't know if it is possible...I would like the code to pass when a list item is selected, OR if a list item is already selected and then the radio button is changed. If this is not possible, then I would be happy with just the list item triggering the new page. I want to do this without the use of a SUBMIT button.Change the appropriate line to this: var page2 = "receiver.html?" + URL+'&vidsize='+form.vidsize[form.vidsize[0].checked?0:1].value;
In both radio button tags insert:onclick='if(site.selectedIndex>0)alpha(this.form)'

lz300
Feb 18th 2007, 7:41 pm
Thank you!

That is exactly what I was looking for.

If anyone is interested, here is the link to what this is for:

http://members.cox.net/lz300a/jukebox/frame_launcher.html