Kevin Waterson wrote:
> My proposal is for an ezcForm component.
> The ezcForm component would provide an interface to the creation
> of HTML form objects which may be rendered for use with templates.

Does it need to depend on the Template component?

> Each form element would be an object which whose properties would
> define how the form would be rendered.
> eg:
> 
> <?php
>   $form = new ezcForm;
> 
>   $form->setMethod('post');
> 
>   $form->setId('my_form_id');
> 
>   $form->setAction($url);
> 
>   $select = new ezcFormSelect;
>   $select->options($array)
>          ->setLabel('My Select')
>          ->setId('my_select_id');
> 
>   $submit = new ezcFormSubmit;
>   $submit->setValue('Click Me')
>          ->setScript('onclick="do_some_js"');
> 
>   $form->render(array($select, $submit));
> ?>

How about CSS for the form? Also it should support different "renderers" 
(HTML, templates, maybe smartphone forms?).

> Also proposed, is the ability to attach validators directly to
> to each object.
> 
> <?php
>   $txt = new ezcFormText;
>   $text->setName="email")
>        ->setId("email")
>        ->setLabel('Enter Email')
>        ->setRequired(true)
>        ->setValidator(ezcFormValidateEmail);
> ?>

How is state being kept? If the user enters a wrong email address it 
needs to appear in the textbox as it was when displaying the page again.

Also how would multi-page forms (wizards) be implemented?

> In this instance, ezcFormValidateEmail could be a call back to
> new ezcInputFormDefinitionElement(
>   ezcInputFormDefinitionElement::REQUIRED, 'validate_email'
>   )

Is it a good idea to depend on another component? (UserInput in this case).

> An ezcForm component will provide a comprehensive suite of
> easy to use form objects with an easy to use API. Forms will
> initially be defined insite a definition list, but other
> markup should not be hard to build in.
> 
> Larson was working on something similar at some time in 
> experimental, but after a quick chat on IRC he described his
> as overly complex.
> 
> Any thoughts, ideas, objections, abuse is welcome.
> 
> Kind regards
> Kevin
> 
> 
> 
>   


-- 
Alexandru Stanoi
System Developer
eZ Systems | http://ez.no
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components

Reply via email to