[Html-widget] latest formfu developments - Container attributes

Mario Minati mario at minati.de
Tue Feb 27 23:55:40 GMT 2007


Carl Franks schrieb:
> On 24/02/07, Mario Minati <mario at minati.de> wrote:
>> Carl Franks schrieb:
>>
>
> I'm thinking of adding some sort of stash for each element, so you can
> pass non-standard data around the code and to the templates.
> That way you could set something like
>    $element->stash->{icon} = 'help';
> Then maybe in the 'field' template file, add an appropriate block to 
> handle it.
I think this is a very nice idea, which gives most flexibility.
>
>> I found the following problems in the code you send me two weeks ago, so
>> I am not sure if they are still relevant:
>> - a fieldset cannot receive class attribute with add_container_attr,
>> only add_attributes worked
>>     my $fs_last = $form->element('Fieldset')->add_attributes( { class =>
>> 'fs_submit_area' } );
>
> Yes, only elements which inherit from 'field' have
> container_attributes() - in that case attributes() refers to the
> actual input/select/etc tag.
> With Fieldset (which inherits from Block) attributes() refers to the
> actual block itself, so there is no other container.
> Do you think that for Blocks, container_attributes() should be
> provided as an alias for attributes() ?
After your explanation and some more code reading I understood the 
difference. When there is a container there are container attributes, no 
container only attributes.
That is straight forward and helps to understand the logic. And I like 
it. For convenience someone might like the idea of the alias and help 
avoiding a FAQ.
>
> Which reminds me - I need to check how Multi handles this - as it's a
> bit of a half-Multi and half-field.
As I saw it in the templates multi is wrapped with a field and has 
therefore both.
>
>>   Where do you think should be the place for the errors, where the
>> labels are, under the labels, where the comments are or under the 
>> comments?
>>   Can we provide a way to switch that programatically (ease of use) or
>> you think changing the templates is always the way to go?
>
> Yeah, I don't really think anything like this belongs in the code - if
> it can't be handled with css, then that's why each project has it's
> own copy of the TT template files - so they can be easily customised.
Ok.
Maybe there can be a place to exchange user generated templates (the 
tt_files) like the css app you provided.
That would be a nice showcase for everyone to learn.

Greets,
Mario




More information about the Html-widget mailing list