[html-formfu] Speed of processing

Carl Franks fireartist at gmail.com
Mon Nov 2 23:42:16 GMT 2009


2009/11/2 Octavian Râşniţă <orasnita at gmail.com>:
> From: "Carl Franks" <fireartist at gmail.com>
> ...
>>
>> Ok, but if each user should have its own form, then how does the cache
>> help
>> the users?
>> I thought that the forms could be saved without the data they contain...
>> only the structure of the form, without any data, which should be the same
>> for all users.
>> In that case the program wouldn't need to parse the config files and
>> wouldn't need to re-generate the form object, but only set that object
>> with
>> the data supplied by the user. Is it possible something like this?
>
> Kahlil didn't say each user needed their own cache, he was describing
> a reason why a cache that doesn't clone the form object would fail.
>
> Ok, but this is what I don't understand. If the form cache can contain just
> the form structure, with no other information or data or errors, then why
> can't 2 or more users use it?
> (Something like the use of cached TT templates by all users)

2 or more users can share it - I don't know where you got that from :)

>> I just found that I need to put a login form on all the pages, so the
>> speed
>> of the entire site would decrease very much because of this...
>
> A form framework has benefits, but it doesn't have to be used 100% of the
> time.
> If the login form on all pages is static (just username / password
> fields), you could probably hardcode the form html in your template
> file.
>
> Is it possible to hard code a form in a template instead of defining it in a
> configuration file and then use HTML::FormFu for processing it, for setting
> the constraints, the validators, filters...?

There are 2 distinct uses of forms:
1) rendering
2) processing
Most of the time you don't really have to think about separating them,
but you can.
As long as your hardcoded form's action="URL" points to a controller
action that loads an appropriate FormFu object containing fields with
the same field-names, it'll work fine.
So, yes, you'll still need a form config file for the login form, but
you'll only need to load it when the user hits the /login action, not
for every other hit.

Carl



More information about the HTML-FormFu mailing list