Hello everyone!
I've just spent about four hours of my life trying to get a simple form to submit. And it wouldn't... I wrote a huge long post here, pleading for some help on the matter only to find the solution (what?! it was that simple?!) by accident myself.
Perhaps the subject has been explained, but I just can't go to bed without sharing this info with anyone who might get as desperately stuck as I did tonight.
Goal: create a simple custom form (I wanted to format it a little, hence the customization).
So, I followed the Forms page in the doc.
Created my own subclass of Form, a template for it, defined the fields and so on.
Here's the mine that I stepped on... in the controller of the Page class on which I wanted to create my form, i wrote a function:
function NewCustomForm() {
return new myCustomForm($this, 'RF');
}
can you see it already?
and of course the appropriate $NewCustomForm call in the template as well.
And nothing happens when I submit the form! Why? jQuery.form returns the whole HTML of my page, WTH????
I don't think this is in the Forms tutorial and I think it should be, I was miserable for hours ;)
THE NAME OF THE FUNCTION THAT CREATES THE FORM HAS TO BE THE SAME AS THE NAME OF THE FORM!!! AS IN:
function NewCustomForm() {
return new myCustomForm($this, 'NewCustomForm');
}
Hope nobody ever gets stuck on that one.
All the best!
Szymon, Poland