0

I am developing a Rails application and I am using mechanize to automate the changing of a profile. Currently I am trying to change a field date that has some sort of mask, as it only displays the format. (dd/mm/yyyy). It has two fields: Birth_Date_Visible, text input, and Birth_Date, hidden_field. I cannot change the hidden field as doing so and submitting the form raises me a 500 server error: unhandled response.

Any ideas on how to do that?

Wiggin
  • 329
  • 1
  • 3
  • 17

1 Answers1

0

The problem may be that you didn't change hidden control readonly attr.

From Mechanize FAQ:

How do I change INPUT TYPE=HIDDEN field values (for example, to emulate the effect of JavaScript code)? As with any control, set the control’s readonly attribute false.

form.find_control("foo").readonly = False # allow changing .value of control foo
form.set_all_readonly(False) # allow changing the .value of all controls
  • hello Nikita, by foo meaning what? I am sorry but I am trying to use this on my code with no succes.. – ingalcala Aug 08 '15 at 17:56
  • 1
    @ingalcala "foo" is the name of control element. Users interact with forms through named controls. For example this is a control element named control2 composed of 2 checkboxes : ` ` – Nikita Kovalyov Oct 23 '15 at 14:05