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.

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));
?>

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);
?>

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


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



  
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components

Reply via email to