1970 Posts in 1275 Topics by 607 members
|Go to End|
6 September 2010 at 2:00pm Last edited: 6 September 2010 2:01pm
I've been wondering where the nested div structure surrounding form fields came from since I could find no template anywhere that specified this.
I finally found it within the FormField.php file (sapphire/forms/FormField.php), which seems a little odd... The functions 'Field', 'FieldHolder' and 'SmallFieldHolder' are all culprits in actually generating html, instead of passing data to a template.
Is there any particular reason for doing it this way? It makes customising form structure more complicated than just having a suitable template local to the site folder.
So, to get around this and regain control, what is the best route. Do I create a local copy of FormField.php as mysite/code/CustomFormField.php?
That being the case, should it extend FormField or RequestHandler, or would either one do?
Thanks in advance.
6 September 2010 at 6:50pm
The reason for this is because in the CMS it was including over 100 form fields per request so having them as templates slowed the CMS down significantly. The change happened over 3 years ago so with the new Zend Caching for the templates might render this point as moot but at the time the performance improvement was worth the hassle!
6 September 2010 at 7:42pm
If I want to apply different layout/markup on specific forms then what would be the best way of achieving this?
Is it possible to have a mysite/code/customFormField.php for this...
Ideally I'd want the middleColumn background colour to change on error, as well as displaying any error message. The classes however change on the input field within the middleColumn div.
I'm looking forward to the day in a few months time when all this will seem trivially easy to me... right now it's overwhelming.
23 January 2012 at 4:05pm Last edited: 23 January 2012 4:06pm
I would also like to know this have tried to subclass FormField and overload the FieldHolder so I can render the form fields with custom markup.
I created a class CustomFormField extends FormField added it it to config but get error:
Fatal error: Object::add_extension() - Extension "CustomFormField" is not a subclass of Extension
Was looking at FormTransformation is there an easier way I am missing here?
|Go to Top|