...

View Full Version : Forms w/Switch-Fieldset



craig
04-06-2003, 07:03 AM
I am trying to hook-up a radio button form.

I would like to send the selected data to a script that would associate the values,names of the form with the URL that corresponds with them.

Then display the coresponding html file in a chromless/sized window.

I have a single example of that working at:ProAm Rodeo,com (http://www.proamrodeo.com/schedules.htm)

The "Quick" link will display that.


The name of the form is associations .

The name of the records of the form are assoc .

The names of the values are (correspond to radio button)

I have tried document.associations.assoc.selectIndex;

But after that I am stuck.

This is the code:

I know that I have to put something in the "submit portion of the script and send it to a script in the <head> </head> section of the HTML file.

Can anyone help?


<html>
<head>
>script to sort urls with names and display html files
</head>

<!-- Assciation Radio Button -->
<DIV Style="position:absolute; top: 348px; left:520px; width:80px; border-width:1; visibility: visible" z-index:6>
<form name="associations ">
<fieldset>
<font face="Arial" size="-3" color="Maroon">
<div></div>
<div><label for="CCPRA"><input type="radio" name="assoc "
value="CCPRA" id="CCPRA" checked>CCPRA</label></div>
<div><label for="CPRA"><input type="radio" name="assoc"
value="CCPRA" id="CPRA" >CPRA</label></div>
<div><label for="CPRA(TX)"><input type="radio" name="assoc"
value="CPRA(TX)" id="CPRA(TX)">CPRA(TX)</label></div>
<div><label for="CRRA"><input type="radio" name="assoc"
value="CRRA" id="CRRA">CRRA</label></div>
<div><label for="GCPRA"><input type="radio" name="assoc"
value="GCPRA" id="GCPRA">GCPRA</label></div>
<div><label for="ICA"><input type="radio" name="assoc"
value="ICA" id="ICA">ICA</label></div>
<div><label for="IMPRA"><input type="radio" name="assoc"
value="IMPRA" id="IMPRA">IMPRA</label></div>
<div><label for="IRCA"><input type="radio" name="assoc"
value="IRCA" id="IRCA">IRCA</label></div>
</fieldset>
</div>

<DIV Style="position:absolute; top: 348px; left:610px; width:80px; border-width:1; visibility: visible" z-index:6>
<fieldset>
<div><label for="KPRA"><input type="radio" name="assoc"
value="KPRA" id="KPRA">KPRA</label></div>
<div><label for="MRA"><input type="radio" name="assoc"
value="MRA" id="MRA">MRA</label></div>
<div><label for="MSRA"><input type="radio" name="assoc"
value="MSRA" id="MSRA">MSRA</label></div>
<div><label for="NDRA"><input type="radio" name="assoc"
value="NDRA" id="NDRA">NDRA</label></div>
<div><label for="NMRA"><input type="radio" name="assoc"
value="NMRA" id="NMRA">NMRA</label></div>
<div><label for="NPRA"><input type="radio" name="assoc"
value="NPRA" id="NPRA">NPRA</label></div>
<div><label for="NRCA"><input type="radio" name="assoc"
value="NRCA" id="NRCA">NRCA</label></div>
<div><label for="radio3"><input type="radio" name="assoc"
value="NWPRA" id="NWPRA">NWPRA</label></div>
</fieldset>
</div>

<DIV Style="position:absolute; top: 368px; left:700px; width:80px; border-width:1; visibility: visible" z-index:6>
<fieldset>
<div><label for="PAFRA"><input type="radio" name="assoc"
value="PAFRA" id="PAFRA">PAFRA</label></div>
<div><label for="Pro-West"><input type="radio" name="assoc"
value="Pro-West" id="Pro-West">Pro-West</label></div>
<div><label for="SDRA"><input type="radio" name="assoc"
value="SDRA" id="SDRA">SDRA</label></div>
<div><label for="TCRA"><input type="radio" name="assoc"
value="TCRA" id="TCRA">TCRA</label></div>
<div><label for="UPRA"><input type="radio" name="assoc"
value="UPRA" id="UPRA">UPRA</label></div>
<div><label for="URA"><input type="radio" name="assoc"
value="URA" id="URA">URA</label></div>
<div><label for="radio3"><input type="radio" name="assoc"
value="WRA" id="WRA">WRA</label></div>
</fieldset>
</div>
</font>

<!-- Associations Schedules Submit Link -->
<DIV Style="position:absolute; top: 312px; left:518px; width:75px; border-width:0; visibility: visible">
<a href="#" onMouseover="window.status='View Association Schedules.'; return true"
onMouseout="window.status=' '; return true" onclick="submit()"Need syntax for submit >Schedules</a>
</div>

<!-- Associations Contact Submit Link -->
<DIV Style="position:absolute; top: 312px; left:610px; width:75px; border-width:0; visibility: visible">
<a href="#" onMouseover="window.status='View Associations Detailed Contact Information.'; return true"
onMouseout="window.status=' '; return true" onclick="submit()";Need syntax for submit >Contact</a>

</div>
</form>
</html>

HairyTeeth
04-07-2003, 01:24 AM
this is what i would do:



<html>
<head>
<title>Untitled</title>
<script type="text/jav&#97;script" language="jav&#97;script">
<!--;
//popup window variable
var pop = null;
function getURL(){
var f = document.associations;
var el,e=0,assocVal,newLoc;
while(el=f.elements[e++]){
if(el.type=='radio'){
len=f[el.name].length;
if(el.checked){
assocVal = el.value.split(",");
newLoc = "http://" + assocVal[1];
//change the width and height to suit yourself;
params = "width=500,height=450,top=50,scrollbars,resizable"
pop=window.open(newLoc,'rodeoWin',params);
break;
}
if(e==len){
alert("Please select a rodeo association");
f.assoc[0].focus()
return false;
}
}
}
return true
}
//-->
</script>
</head>
<body>
<form action="" method="post" name="associations">
<input type="radio" name="assoc"
value="ccpra,www.codingforums.com/" checked="checked"/>CCPRA
<br />
<input type="radio" name="assoc"
value="cpra,www.javascriptkit.com" />CPRA
<br />
<input type="radio" name="assoc"
value="cpra(tx),www.objenv.com/cetus/oo_javascript.html" /> CPRA
<br />
<input type="radio" name="assoc" value="crra,ww.w3.org/" />CRRA
<br />
<div id="divSub"
<a href="#"
onMouseover="window.status='View Association Schedules.'; return true"
onMouseout="window.status=' ';return true"
onclick="getURL()">Schedules</a>
</div>
</form>
</body>
</html>


change the value in each radio input to include the url of the page you want to open:


<input type="radio" value="ccpra,www.someURL.com/page.html"

IMPORTANT: You must separate the association acronym and the url with a comma (without a space - just to be sure). The value set up lie this is more a matter of convenience.
Set the div for submission as per the 'schedules' div/link above. There is no need to change the script provided you use the same form name and values. You can however manipulate the popup window to suit (as indicated in the script comment). Hope that helps.

craig
04-07-2003, 01:45 AM
Thank you very much.

The problem I am having is that the radio buttoms need to
refrence two seperate locations.

ProAm Rodeo.com/shcedules.htm (http://www.proamrodeo.com/schedules.htm)

One displays schedules.

The other displays Detailed contact information


They both use the radio button(associations) to direct the user to the correct url (html page)

Each Selection leads in differnet ways.

Schedules+CCPRA=CCPRAschs.html(Rodeo Schedules)

Thank you again for your help.


Contact+CCPRA=CCPRAcontc.html(Detailed contact association information)

"Quick"=AssociationQuick.html(Brief Association contact information)

I was trying to use a Switch as opposed to a If Then Else to try and simplify this situation.

That way I could compare the radio button(s) with the "submit" paths or parse info to script to goto the unique URL's

HairyTeeth
04-07-2003, 02:44 AM
try this:


<html>
<head>
<title>Untitled</title>
<script type="text/jav&#97;script" language="jav&#97;script">
<!--;
//popup window variable
var pop = null;
function getURL(n){
var f = document.associations;
var el,e=0,assocVal,selectedLoc;
while(el=f.elements[e++]){
if(el.type=='radio'){
len=f[el.name].length;
if(el.checked){
assocVal = el.value.split(",");

switch(n){
case "contact":
selectedLoc = "http://" + assocVal[0];
break;
case "schedule":
selectedLoc = "http://" + assocVal[1];
break;
}

//change the width and height to suit yourself;
params = "width=500,height=450,top=50,scrollbars,resizable"
pop=window.open(selectedLoc,'rodeoWin',params);

break;
}
if(e==len){
alert("Please select a rodeo association");
f.assoc[0].focus();
return false;
}
}
}
return true
}
//-->
</script>
</head>
<body>
<form action="" method="post" name="associations">
<input type="radio" name="assoc"
value="www.CONTACT_PAGE001.html,www.codingforums.com/"
checked="checked"/>CCPRA
<br />
<input type="radio" name="assoc"
value="www.CONTACT_PAGE002.html,www.javascriptkit.com/" />CPRA(tx)
<br />
<input type="radio" name="assoc"
value="www.CONTACT_PAGE003.html,www.objenv.com/cetus/oo_javascript.html" /> CPRA
<br />
<input type="radio" name="assoc"
value="www.CONTACT_PAGE004.html,www.w3.org/" />CRRA
<br />
<div>
<a href="jav&#97;script:void(0)"
onMouseover="window.status='View Association Schedules.'; return true"
onMouseout="window.status='';return true"
onclick="getURL('schedule')">Schedules</a>
</div>

<div id="contactPage">
<a href="jav&#97;script:void(0)"
onMouseover="window.status='View Association Schedules.'; return true"
onMouseout="window.status='';return true"
onclick="getURL('contact')">Contact Info</a>
</div>
</form>
</body>
</html>


You could replace the whole switch statement with:


selectedLoc =(n=='contact')? "http://" + assocVal[0] : "http://"+assocVal[1];

if you only had two different url paths.
:)

craig
04-07-2003, 05:26 AM
I have two(2) urls for each radio button?

One gives the "schedules" and one gives the "contact" information.

There are 23 radio buttons.

I have been trying to do something like:

If "schedules (Submit button name) && (radio button name)"
{
url1
}
elseIf "contact (submit button name) && (radio button name)"
{
url 2
}

I see that you are putting both urls in the value statement.

I thought that it might make it easier to update the form from a visual stand point.

Thank you

I will try to substitute the code below for the switch function.

HairyTeeth
04-07-2003, 05:46 AM
lol, i though you had a separate contact page for each association. I don't know why your bothering with radio buttons - all you need is an ordered or unordered list...still:



<html>
<head>
<title>Untitled</title>
<script type="text/javascript" language="javascript">
<!--;
//popup window variable
var pop = null;
function getURL(n){
var f = document.associations,len;
var el,e=0,cLoc,sLoc;
sLoc="http://www.whatever.com/CCPRAschs.html";
cLoc ="http://www.whatever.com/AssociationQuick.html"
while(el=f.elements[e++]){
len=f[el.name].length;
if(el.type=='radio'){
if(el.checked){
selectedLoc =(n=='schedule')? sLoc : cLoc
//change the width and height to suit yourself;
params = "width=500,height=450,top=50,scrollbars,resizable"
if(!pop || pop.closed)
pop=window.open(selectedLoc,'rodeoWin',params);
else
pop.focus();

break;
}
if(e==len){
alert("Please select a rodeo association");
f.assoc[0].focus();
return false;
}
}
}
return true
}
//-->
</script>
</head>
<body>
<form action="" method="post" name="associations">
<input type="radio" name="assoc"
<input type="radio" name="assoc" value="cpra" /> CPRA
<br />
<input type="radio" name="assoc" value="crra" />CRRA
<!-- etc etc etc etc -->

<div>
<a href="javascript:void(0)" onMouseover="window.status='View Association Schedules.'; return true" onMouseout="window.status='';return true" onclick="getURL('schedule')">Schedules</a>
</div>

<div id="contactPage">
<a href="javascript:void(0)" onMouseover="window.status='View Association Schedules.'; return true" onMouseout="window.status='';return true" onclick="getURL('contact')">Contact Info</a>
</div>
</form>
</body>
</html>

craig
04-08-2003, 06:39 PM
I have two different directions to go for each radio button.
(One) will display the schedule for the Association.
The other (two) will display the contact information.

You can see the GUI at:
Proamrodeo.com/schedules.htm (http://www.proamrodeo.com/schedules.htm)
I had to take care of some personal business yeaterday but I am back on the job today.

Thank you.

craig
04-09-2003, 02:14 AM
Dear Hairy:

Thank you for this great approach.

Everything works fine except I can't get it to keep counting for the last three(3) radio buttons in the third(3) column.

It keeps falling through on the last three radio buttons on the third column and executes the "alert" expression.

It seems to display an Error code when the alert finction is displayed.

It says Error Code: 0 'assoc.0' is null or not an object.

I have been trying to insert:

code:--------------------------------------------------------------------------------
selectedLoc =(n=='contact')? "http://" + assocVal[0] : "http://"+assocVal[1];
--------------------------------------------------------------------------------

I thought that might solve the problem.

Below is the Form code that I have been using.

<!-- Association Radio Button -->
<font face="Arial" size="-3" color="Maroon">
<form method="post" name="associations">

<DIV Style="position:absolute; top: 348px; left:520px; width:80px; border-width:1; visibility: visible" z-index:2>
<fieldset>
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/CPRA_contact.htm,www.proamrodeo.com/database/CCPRAschs.html"checked/>CCPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/CPRAschs.html"/>CPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/CPRA(TX)schs.html"/>CPRA(TX)<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/CRRAschs.html"/>CRRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/GCPRAschs.html"/>GCPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/ICAschs.html"/>ICA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/IMPRAschs.html"/>IMPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/IRCAschs.html"/>IRCA<br />
</fieldset>
</DIV>

<DIV Style="position:absolute; top: 348px; left:610px; width:80px; border-width:1; visibility: visible" z-index:2>
<fieldset>
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/KPRAschs.html">KPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/MRAschs.html">MRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/MSRAschs.html">MSRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/NMRAschs.html">NMRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/NWPRAschs.html">NWPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/NDRAschs.html">NDRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/NPRAschs.html">NPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/NRCAschs.html">NRCA<br />
</fieldset>
</DIV>


<DIV Style="position:absolute; top: 368px; left:700px; width:80px; border-width:1; visibility: visible" z-index:2>
<fieldset>
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/PAFRAschs.html">PAFRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/Pro-Westschs.html">Pro-West<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/SDRAschs.html">SDRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/TCRAschs.html">TCRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/URAschs.html">URA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/UPRAschs.html">UPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/WRAschs.html">WRA<br />
</fieldset>
</DIV>
</font>

<!-- Associations Schedules Submit Link -->
<DIV Style="position:absolute; top: 311px; left:518px; width:75px; border-width:0; visibility: visible">
<a href="javascript:void(0)"
onMouseover="window.status='View Association Schedules.'; return true"
onMouseout="window.status='';return true"
onclick="getURL('schedule')">Schedules</a>

</DIV>

<!-- Associations Contact Submit Link -->
<DIV id="contactPage" Style="position:absolute; top: 311px; left:610px; width:75px; border-width:0; visibility: visible">
<a href="javascript:void(0)"
onMouseover="window.status='View Association Detailed Contact Information.'; return true"
onMouseout="window.status='';return true"
onclick="getURL('contact')">Contact</a>
</div>
</form>

HairyTeeth
04-09-2003, 04:31 AM
Try this. Note that i've removed the split() method and taken the 'associationsQuick.html' string out of the radio value.
You don't need it there if there is only one url for each associations contact information (aside from the first value which i've branched using an if..else statement.


<html>
<head>
<title>Untitled</title>
<script type="text/javascript" language="javascript">
<!--;
//popup window variable
var pop = null;
function getURL(n){
var f = document.associations;
var el,e=0,selectedLoc,grp,i;
var contactLink=''


while(el=f.elements[e++]){
if(el.type=='radio' && el.name && f[el.name].length){
grp=f[el.name]
i=0
while(el=grp[i++])
if(el.checked){
if(el.value == "www.proamrodeo.com/database/CCPRAschs.html")
contactLink = "http://www.proamrodeo.com/database/CPRA_contact.htm"
else
contactLink="http://www.proamrodeo.com/database/associationsQuick.html"

selectedLoc =(n=='contact')? contactLink:"http://"+el.value
//change the width and height to suit yourself;
params = "width=500,height=450,top=50,scrollbars,resizable"
pop=window.open(selectedLoc,'rodeoWin',params);
pop.focus();

break;
}
if(i > grp.length){
alert("Please select a rodeo association");
f.Assoc[0].focus();
return false;
}
e+=grp.length -1
}
}
return true
}
//-->
</script>
</head>
<body>
<form action="" method="post" name="associations">
<!-- Association Radio Button -->
<font face="Arial" size="-3" color="Maroon">
<form method="post" name="associations">

<DIV Style="position:absolute; top: 348px; left:520px; width:80px; border-width:1; visibility: visible" z-index:2>
<fieldset>
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/CCPRAschs.html"checked/>CCPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/CPRAschs.html"/>CPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/CPRA(TX)schs.html"/>CPRA(TX)<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/CRRAschs.html"/>CRRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/GCPRAschs.html"/>GCPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/ICAschs.html"/>ICA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/IMPRAschs.html"/>IMPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/IRCAschs.html"/>IRCA<br />
</fieldset>
</DIV>

<DIV Style="position:absolute; top: 348px; left:610px; width:80px; border-width:1; visibility: visible" z-index:2>
<fieldset>
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/KPRAschs.html">KPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/MRAschs.html">MRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/MSRAschs.html">MSRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/NMRAschs.html">NMRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/NWPRAschs.html">NWPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/NDRAschs.html">NDRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/NPRAschs.html">NPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/NRCAschs.html">NRCA<br />
</fieldset>
</DIV>


<DIV Style="position:absolute; top: 368px; left:700px; width:80px; border-width:1; visibility: visible" z-index:2>
<fieldset>
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/PAFRAschs.html">PAFRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/Pro-Westschs.html">Pro-West<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/SDRAschs.html">SDRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/TCRAschs.html">TCRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/URAschs.html">URA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/UPRAschs.html">UPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/WRAschs.html">WRA<br />
</fieldset>
</DIV>
</font>

<!-- Associations Schedules Submit Link -->
<DIV Style="position:absolute; top: 311px; left:518px; width:75px; border-width:0; visibility: visible">
<a href="javascript:void(0)"
onMouseover="window.status='View Association Schedules.'; return true"
onMouseout="window.status='';return true"
onclick="getURL('schedule')">Schedules</a>

</DIV>

<!-- Associations Contact Submit Link -->
<DIV id="contactPage" Style="position:absolute; top: 311px; left:610px; width:75px; border-width:0; visibility: visible">
<a href="javascript:void(0)"
onMouseover="window.status='View Association Detailed Contact Information.'; return true"
onMouseout="window.status='';return true"
onclick="getURL('contact')">Contact</a>
</div>
</form>
</div>
</form>
</body>
</html>

craig
04-09-2003, 05:44 AM
Thank you once again.

I placed a line:
(Three(3) Total)
<input name="test" type="hidden">

In the top line of each <fieldset> group.

That caused three more radio buttons to fail to be referenced.
Total of six(6). [Originally Three(3)]

Thought that might cause the results to get passed through but it added to the original three(3).

Something seems to be causing one(1) of the radio buttons in each <fieldset> group to be not counted.

It seems to pass it on in the form.




Radio Button URLS: (seperate issue)

Each radio buttons reference two(2) unique urls.

A third url is used for a seperate Submit button called "Quick"

Each radio button has two(2) unique urls associatied with them.

I have just used:
http://www.proamrodeo.com/database/associationsQuick.html"
Repeatablity just for something to put in there.

I will replace the "contact" url associated with each radio button(association) with it's own unique url once the pages(url's) get created.

The only time that:
http://www.proamrodeo.com/database/associationsQuick.html"
Will be used is in the Quick link (only).

I will keep on trying to track down what ever is causing one(1) radio button per <fieldset> to fail to be counted.

It seems that when the variable [var el,e=0] is set to zero(0) and it loops through the <fieldset> group it eventually sets itself to zero(0) addeding a extra numerical value to the total in the form.

It appears that it does it three times.

Although when I added the "Hidden" line in each <Fieldset> it added to the number of the radio button that failed to be counted. (Shouldn't have done that based on the above therory)

HairyTeeth
04-09-2003, 06:26 AM
This script works (as did the one before)...make sure you use this script.
The hidden input makes no difference so i'm not sure whats happening at your end.
I've added another qualifer to make sure the script only runs with the 'Assoc' radio button set.
Also, make sure that there are no spaces in the word "jav&#97;script", wherever it may occur in the script.



<html>
<head>
<title>Untitled</title>
<script type="text/javascript" language="javascript">
<!--;
//popup window variable
var pop = null;
function getURL(n){
var f = document.associations;
var el,e=0,selectedLoc,grp,i,assocVal;


while(el=f.elements[e++]){
if(el.type=='radio' && el.name && f[el.name].length){
grp=f[el.name]
i=0
while(el=grp[i++])
if(el.name==='Assoc' && el.checked){
assocVal = el.value.split(",")

selectedLoc =(n=='contact')? "http://"+assocVal[0]:"http://"+assocVal[1]
//change the width and height to suit yourself;
params = "width=500,height=450,top=50,scrollbars,resizable"
pop=window.open(selectedLoc,'rodeoWin',params);
pop.focus();
break;
}
if(i > grp.length){
alert("Please select a rodeo association");
f.Assoc[0].focus();
return false;
}
e+=grp.length -1
}
}
return true
}
//-->
</script>
</head>
<body>
<form action="" method="post" name="associations">
<!-- Association Radio Button -->
<font face="Arial" size="-3" color="Maroon">
<form method="post" name="associations">

<DIV Style="position:absolute; top: 348px; left:520px; width:80px; border-width:1; visibility: visible" z-index:2>
<DIV Style="position:absolute; top: 348px; left:520px; width:80px; border-width:1; visibility: visible" z-index:2>
<fieldset>
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/CPRA_contact.htm,www.proamrodeo.com/database/CCPRAschs.html"checked/>CCPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/CPRAschs.html"/>CPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/CPRA(TX)schs.html"/>CPRA(TX)<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/CRRAschs.html"/>CRRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/GCPRAschs.html"/>GCPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/ICAschs.html"/>ICA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/IMPRAschs.html"/>IMPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/IRCAschs.html"/>IRCA<br />
</fieldset>
</DIV>

<DIV Style="position:absolute; top: 348px; left:610px; width:80px; border-width:1; visibility: visible" z-index:2>
<fieldset>
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/KPRAschs.html">KPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/MRAschs.html">MRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/MSRAschs.html">MSRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/NMRAschs.html">NMRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/NWPRAschs.html">NWPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/NDRAschs.html">NDRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/NPRAschs.html">NPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/NRCAschs.html">NRCA<br />
</fieldset>
</DIV>


<DIV Style="position:absolute; top: 368px; left:700px; width:80px; border-width:1; visibility: visible" z-index:2>
<fieldset>
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/PAFRAschs.html">PAFRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/Pro-Westschs.html">Pro-West<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/SDRAschs.html">SDRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/TCRAschs.html">TCRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/URAschs.html">URA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/UPRAschs.html">UPRA<br />
<input name="Assoc" type="radio"
value="www.proamrodeo.com/database/associationsQuick.html,www.proamrodeo.com/database/WRAschs.html">WRA<br />
</fieldset>
</DIV>
</font>


<!-- Associations Schedules Submit Link -->
<DIV Style="position:absolute; top: 311px; left:518px; width:75px; border-width:0; visibility: visible">
<a href="javascript:void(0)"
onMouseover="window.status='View Association Schedules.'; return true"
onMouseout="window.status='';return true"
onclick="getURL('schedule')">Schedules</a>

</DIV>

<!-- Associations Contact Submit Link -->
<DIV id="contactPage" Style="position:absolute; top: 311px; left:610px; width:75px; border-width:0; visibility: visible">
<a href="javascript:void(0)"
onMouseover="window.status='View Association Detailed Contact Information.'; return true"
onMouseout="window.status='';return true"
onclick="getURL('contact')">Contact</a>
</div>
</form>
</div>
</form>
</body>
</html>

craig
04-09-2003, 06:30 AM
I took out the following code:

if(e==len){
alert("Please select a rodeo association");
f.assoc[0].focus()
return false;
}

It seems to work now.

Not sure why this is happening.

Thought it might be the return false needed to be set to return true.

Anyway it seems to be working now.

CowFarmer mentality:
If it works don't mess with it.

OR

If its not broke just keep fixing it till it is!

HairyTeeth
04-09-2003, 06:35 AM
yeah, that will work, but just in case, use the script in my previous post. Cheers farmer.

craig
04-09-2003, 06:40 AM
Thank you for your help.
This forum is helpful as always.
I am getting better at understanding this.
Hopefully as I go on I will become more profecient at this.

HairyTeeth
04-09-2003, 06:47 AM
Originally posted by craig

Hopefully as I go on I will become more profecient at this.

Same here. This has been a good learning experience for me using this particular script. Thank you! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum