Reputation: 2046
I thought I had Mechanize locked down with regards to setting form field values, but my submission isn't taking. CCCform is my form object, so my field set is this for the field in question:
CCCform['searchCriteriaBean.conceptOperator'] = 'accrue'
For some reason the server is returning that I've asked for something else. I've checked the form that's been filled, and everything looks great. For some reason it isn't sending the real value. The three values possible are "accrue", "any" and "" (nil), as these are mutually exclusive radio buttons. It sends an operator to the server to choose how to manage more than one search text in a field called searchCriteriaBean.textField.
I've looked over this thing 20 times and I can't figure out why it's not sending the right value. The web form works fine.
Any advice appreciated. Cheers
Upvotes: 0
Views: 355
Reputation: 106027
You need to use the RadioButton#check
method on the radio button element you want to select. You'll find the element with Form#radiobuttons_with
. It'll look something like this:
radio = CCCform.radiobuttons_with :name => 'searchCriteriaBean.conceptOperator',
:value => 'accrue'
radio.check
Upvotes: 1