[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

how to access radio button

Posted on 2006-06-27
6
Medium Priority
?
228 Views
Last Modified: 2010-04-01
I see the following error onclicking the radio button.
Error: 'document.form.revrp' is null or not an object

Here is the code

<BODY>
<SCRIPT>
function getSelRadio(var radiogrp)
{
      for (var counter = 0; counter < radiogrp.length; counter++)
      {
             alert(radiogrp[counter].value);
       }
}
      </script>
      
<TABLE BGCOLOR="white" BORDER="0">
      <TR>
          <TD><input type="radio" name="revgrp" value="0"  checked>Default<br></TD>
          <TD><input type="radio" name="revgrp" value="2" onClick = "getSelRadio(document.form.revgrp)" >Maximum value of x Axis<br></TD>
            <TD> <input name="maxrevaxis" type="text" value="20000" /> </TD>
      </TR>

</TABLE>
</BODY>
0
Comment
Question by:MFC123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
suprapto45 earned 400 total points
ID: 16997725
Hi,

Try to change it as

onClick = "getSelRadio(this)"

David
0
 

Assisted Solution

by:gotekareddy
gotekareddy earned 400 total points
ID: 17029832
better go for this :

<html>
<head>
<script language="javascript">
function getSelRadio(var radiogrp)
{
     for (var counter = 0; counter < radiogrp.length; counter++)
     {
        if(radiogrp[counter].checked)
          {
                alert(radiogrp[counter].value);
          }
      }
}


</script>
</head>
<body>
<form>
<TABLE BGCOLOR="white" BORDER="0">
     <TR>
         <TD><input type="radio" name="revgrp" value="0"  checked>Default<br></TD>
         <TD><input type="radio" name="revgrp" value="2" onClick = "getSelRadio(this)" >Maximum value of x Axis<br></TD>
          <TD> <input name="maxrevaxis" type="text" value="20000" /> </TD>
     </TR>

</TABLE>

</form
</body>
</html>
0
 
LVL 9

Assisted Solution

by:owenli27
owenli27 earned 400 total points
ID: 17101497
I have same problem before. I solved it by using this:

function getSelRadio()
{
     for (var counter=0; counter < document.MyForm.radiogrp.length; counter++)
     {
           alert( document.MyForm.radiogrp[counter].value );
     }
}

<FORM NAME="MyForm" METHOD="POST" ACTION="./doWhatEver.do">  
<TABLE BGCOLOR="white" BORDER="0">
     <TR>
         <TD><input type="radio" name="revgrp" value="0"  checked>Default<br></TD>
         <TD><input type="radio" name="revgrp" value="2" onClick="getSelRadio()">Maximum value of x Axis<br></TD>
          <TD> <input name="maxrevaxis" type="text" value="20000" /> </TD>
     </TR>
</TABLE>
</FORM>
</BODY>
0
 
LVL 9

Expert Comment

by:owenli27
ID: 17105412
document.MyForm.radiogrp  should be  document.MyForm.revgrp

function getSelRadio()
{
     for (var counter=0; counter < document.MyForm.revgrp.length; counter++)
     {
           alert( document.MyForm.revgrp[counter].value );
     }
}
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working from home is a dream for many people who aren’t happy about getting up early, going to the office, and spending long hours at work. There are lots of benefits of remote work for employees.
An overview of cyber security, cyber crime, and personal protection against hackers. Includes a brief summary of the Equifax breach and why everyone should be aware of it. Other subjects include: how cyber security has failed to advance with technol…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question