# Mechanize and Radiobuttons

**URL:** <https://www.ruby-forum.com/t/mechanize-and-radiobuttons/102411>\
**Category:** Ruby\
**Created:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/mechanize-and-radiobuttons/102411 "2006-08-15T14:16:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![barjunk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@barjunk](https://www.ruby-forum.com/u/barjunk)\
**Post date:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/mechanize-and-radiobuttons/102411/1 "2006-08-15T14:16:54Z")

</div>

I have found Mechanize fairly intuitive and easy to use. (after  
learning some HTML! :)) and wondered if I’m doing something wrong when  
using radiobuttons.

There are two radio buttons on the form I am working with and wondered  
if when I set the second button

forms.radiobuttons[1].checked=true

It leaves radiobuttons[0] (the default button on the form) checked  
value as true as well.

It’s no problem to just set the originally set radiobutton  
forms.radiobuttons[0]=false, but since that’s not how a radio button  
control would work in a browser, I thought I might be doing something  
wrong.

Thanks for producing such an awesome tool!

Mike B.

---

<div class="post-metadata">

**Author:** ![barjunk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@barjunk](https://www.ruby-forum.com/u/barjunk)\
**Post date:** [August 15, 2006, 2:19pm UTC](https://www.ruby-forum.com/t/mechanize-and-radiobuttons/102411/2 "2006-08-15T14:19:55Z")

</div>

On 8/11/06, barjunk [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> value as true as well.
> 
> It’s no problem to just set the originally set radiobutton  
> forms.radiobuttons[0]=false, but since that’s not how a radio button  
> control would work in a browser, I thought I might be doing something  
> wrong.
> 
> Thanks for producing such an awesome tool!
> 
> Mike B.

That’s probably an HTML problem in the form. See  
[HTML Forms](http://www.w3schools.com/html/html_forms.asp) for an example. Note that  
the name attribute must be set to the same string for each button in  
the group.

-A
