[Html-widget] HTML::Widget::Element::Field

Carl Franks fireartist at gmail.com
Tue Oct 31 11:20:00 GMT 2006


On 31/10/06, Zbigniew Lukasiak <zzbbyy at gmail.com> wrote:
> Hi,
>
> Answering Carl's comment on my blog post at:
> http://www.blogger.com/comment.g?blogID=36345871&postID=116134505314349604
> where inspired by an email from this list I compared HTML::Widget with
> Rails Helpers.
>
> Carl writes:
>
> > I've edited H::W, to make it possible to add a 'Field' type element to achieve this.
>
> > $widget->element(Field => foo);
> > $result->field_xml( foo => 'Textfield', %attrs );
>
> That's a fast reply!  Looks like HTML::Widget is really moving fast
> ahead.  Now I need to think how to incorporate that into InstantCRUD.
> But I have one more idea.  How about:
>
> $result->Textfield('foo', %attrs)
>
> What do you think?
>
> And by the way - the explanation message for a failing constraing
> logically also belongs to  the templates.  But it is so tightly
> coupled to the actual code of the constraint that I don't see a good
> solution to this.

I don't have as much time as I'd like to reply properly, so I'll
expand on this later... hopefully there'll be some conversation around
this though!

As I mentioned in the blog reply, the $result->field_xml() feature
hasn't been added to svn - it's just something I've experimented with
on my desktop.

How would this method be used? Would you be calling it in the template
for every field in the form? What about the form tags? hidden form
fields? buttons? This seems a step backwards.
Can you describe an API that would allow you to use $result->as_xml
for /most/ of the form, but override just 1 or 2 fields?
Would using separate template files for each field help, letting you
change templates on each form / field?

I'd like a better idea of how you'd like to use it, and what other H-W
things are causing you issues, before adding yet another method to
what is becoming a thick soup.

There are some things I'd like to rework - I don't like how element
containers are done - I don't like that $result->elements() returns
containers which already have a HTML::Element baked in them - I'd like
it to be simple to point to a folder of templates to use for xml/html
generation - have an agreed css lexicon (as mentioned in the "Catalyst
Marketing Plan Draft" thread on the catalyst-dev list), etc...
Do we want to support "nested" params, like[this], is so how would they be used?

I'd also like to clear up the mess of methods in $widget and $result.
Do we really need $w->get_elements() # non-recursive
and $w->find_elements() # recursive ... ?

At this moment I don't know how backward-compatible these things would
be, and whether this will need to be in a new namespace, or whether it
would be acceptable to move the existing code to H::W::Compat and
develop H::W afresh?

Carl



More information about the Html-widget mailing list