Radion Button (Poll)

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
phppick
Forum Commoner
Posts: 57
Joined: Thu Aug 14, 2003 5:59 am

Radion Button (Poll)

Post 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??
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

What is your code?

:)
phppick
Forum Commoner
Posts: 57
Joined: Thu Aug 14, 2003 5:59 am

Sorry Steveo

Post 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;
}
}
TheBentinel.com
Forum Contributor
Posts: 282
Joined: Wed Mar 10, 2004 1:52 pm
Location: Columbus, Ohio

Re: Sorry Steveo

Post 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.
phppick
Forum Commoner
Posts: 57
Joined: Thu Aug 14, 2003 5:59 am

Sorry

Post by phppick »

I Checked Its not Working with the code you have given.. :(
Post Reply