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??
Radion Button (Poll)
Moderator: General Moderators
Sorry Steveo
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;
}
}
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
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.