Page 1 of 1

Radion Button (Poll)

Posted: Tue Mar 16, 2004 4:31 am
by phppick
Hi

I writing validation for Poll in my page.. The no of radio buttions comes from database. i wrote code to Validate wether atleast one Radio button is selected or not Like as follows.. This code is working fine IE (MAC), But not working in Camino, Mozilla (MAC) .. anybody can help??

Posted: Wed Mar 17, 2004 12:05 am
by Steveo31
What is your code?

:)

Sorry Steveo

Posted: Wed Mar 17, 2004 8:04 pm
by phppick
The Code is


function PollIT()
{

if (f1())
{

window.open('insertpoll.php?postid='+frmpoll.postid.value+'&poll_id='+frmpoll.poll_id.value+'&poll='+poll,'Result', 'width=400,height=200,left=0,top=0, location=no, menubar=no, status=no, toolbar=no, scrollbars=AUTO, resizable=no' );

}

function f1()
{
myOption = -1;
for (i=0; i<frmpoll.poll.length; i++) {
if (document.frmpoll.poll.checked) {
myOption = i;
poll=document.frmpoll.poll.value;
}
}

if (myOption == -1) {
alert("You must select Poll Option");
return false;
}
return true;
}
}

Re: Sorry Steveo

Posted: Wed Mar 17, 2004 8:16 pm
by TheBentinel.com
phppick wrote: if (document.frmpoll.poll.checked) {


Do all browsers support the document.formName.field shorthand?

You might try:
document.forms["frmpoll"].poll.checked

Or even:
document.forms["frmpoll"]["poll"].checked

Worth a whack, at least. Javascript makes me batty.

Sorry

Posted: Thu Mar 18, 2004 2:50 am
by phppick
I Checked Its not Working with the code you have given.. :(