Search code examples
ruby-on-railsrubywww-mechanize

Accessing hidden field values using Ruby Mechanize


I am trying to access the form values of hidden fields so I can set them or retrieve them.

I tried the form.field_with() method as well as just form.fieldname and cannot figure out how to get a reference back for a hidden field.


Solution

  • In general you just do:

    form['foo'] = 'bar'
    

    That goes for all kinds of form fields, not just hiddens.