# Mechanize SelectList Issue

**URL:** <https://www.ruby-forum.com/t/mechanize-selectlist-issue/89495>\
**Category:** Ruby\
**Created:** [March 20, 2007, 9:15pm UTC](https://www.ruby-forum.com/t/mechanize-selectlist-issue/89495 "2007-03-20T21:15:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwcooper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f14d63/32.png) [@jwcooper](https://www.ruby-forum.com/u/jwcooper)\
**Post date:** [March 20, 2007, 9:15pm UTC](https://www.ruby-forum.com/t/mechanize-selectlist-issue/89495/1 "2007-03-20T21:15:40Z")

</div>

Hi,

I have been pretty successful in using Mechanize for submitting forms  
of all types. The following select list has been giving me trouble to  
no ends. I am not able to get it to submit for any reason. It  
actually submits the form, but when I look at what I submitted, the  
value is always blank.

Here is the select list:

Please Select  
YO  
HELLO  
HOLA

One thing to note is that the 's don’t get closed (\</  
option\>). Would this cause issues with Mechanize? When I “pp” the  
page it seems list the three options with the correct text (although  
it looks like this ‘YO\n\t\t\t\t\t’), and with ‘null’ values.

Here is what I have tried to no avail:

form.fields.name(‘Greetings’).options[1].click  
form.fields.name(‘Greetings’).options[1].select  
form.field(‘Greetings’).options[1].select  
form.field(‘Greetings’).options[1].click  
form.fields(‘Greetings’).options[1].click

I can successfully grab the values out of the options by using:

myselectlist = form.fields.name(‘Greetings’).options[1]  
puts myselectlist.text

Any ideas on why I can’t submit the form with the option I want to  
select? I can submit the form, but the ‘select’ never gets  
processed. No errors are thrown.

Thank you for any help you can provide!

---

<div class="post-metadata">

**Author:** ![jwcooper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f14d63/32.png) [@jwcooper](https://www.ruby-forum.com/u/jwcooper)\
**Post date:** [March 21, 2007, 4:41pm UTC](https://www.ruby-forum.com/t/mechanize-selectlist-issue/89495/2 "2007-03-21T16:41:47Z")

</div>

On Mar 20, 3:13 pm, “jwcooper” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> \<select style=“font-family: Arial, sans-serif; font-size: 11px;”  
> it looks like this ‘YO\n\t\t\t\t\t’), and with ‘null’ values.
> 
> myselectlist = form.fields.name(‘Greetings’).options[1]  
> puts myselectlist.text
> 
> Any ideas on why I can’t submit the form with the option I want to  
> select? I can submit the form, but the ‘select’ never gets  
> processed. No errors are thrown.
> 
> Thank you for any help you can provide!

I am still a bit out of luck on this one. Anyone have any ideas?

I’ve also tried just setting the value of the select list to my  
desired value, and that didn’t work either.

Thank you!
