TL;DR: use different driver or make sure form elements are actually inside the form.
Goutte driver is pretty awesome, but not as awesome as the real browser. It gets the response content and uses Goutte scrapper to analyse it. To add some spice your testing it allows you to enter and submit form data by intercepting value setting calls and storing form data in the object. When you click on a button (I'd assume only on type="submit"
) that form data is added into request data and sent to the server.
In order to create that form object it searches for the closest parent form to get the basic form details. So, when you try to set a value on the input that is not part of the form, or do a submit without a form – it can't find the form and throws an exception.
Ensuring that form elements sit inside the form tag should resolve such issues. Alternatively you can use Selenium2 driver – it uses a completely different mechanism.