# Rails app with javasript

**URL:** <https://www.ruby-forum.com/t/rails-app-with-javasript/157284>\
**Category:** Rails\
**Created:** [January 9, 2009, 6:26am UTC](https://www.ruby-forum.com/t/rails-app-with-javasript/157284 "2009-01-09T06:26:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![santoshturamari](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@santoshturamari](https://www.ruby-forum.com/u/santoshturamari)\
**Post date:** [January 9, 2009, 6:26am UTC](https://www.ruby-forum.com/t/rails-app-with-javasript/157284/1 "2009-01-09T06:26:22Z")

</div>

i hav a problem… to fetch a correponding value of radio button.

```
</td>
<td>
<span class="ysmall">
  <div id="Q1" class="yui-buttongroup">
  <%= radio_button :org_review, :Q1, 5%>
  <%= radio_button :org_review, :Q1, 4%>
  <%= radio_button :org_review, :Q1, 3%>
  <%= radio_button :org_review, :Q1, 2%>
  <%= radio_button :org_review, :Q1, 1%> </div></span>
</td>

```

Like this I have from Q1 to Q20… later I want to get the  
corresponding values of Q1 to Q20… to know if all are same then  
display a message…

```
var Qarray1 = new

```

Array(“1”,“2”,“3”,“4”,“5”,“6”,“7”,“8”,“9”,“10”,“11”,“12”,“13”,“14”,“15”,“16”,“17”,“18”,“19”,“20”);

```
var m = 0;
var n = Qarray1[m];
$temp = "org_review[Q" + n + "]";
$res1 = document.getElementById($temp)
 var flag = 0;

```

for (var j = 1; j \<= 20; j++)  
{  
$temp1 = “org\_review[Q” + j + “]”;  
$res2 = document.getElementById($temp1)

```
        if ($res1 == $res2)
 {
           alert($temp);
        flag = 1;
 }
 else
 {
    flag = 0;
       }
  }
 if (flag == 1)
 {
         alert("Hey, please go throgh the questions... Its not

```

boring");  
return false;  
}  
}

But I am not able to fetch the vales… pls help me out somebody.
