Re: [Components] New Component Proposal
On Mon, 15 Dec 2008, 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. > > Each form element would be an object which whose properties would > define how the form would be rendered. > eg: > >$form = new ezcForm; > > $form->setMethod('post'); > $form->setId('my_form_id'); > $form->setAction($url); Usually, we would just use properties for this, and not setter methods. > > $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. > >$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. I'd be nice to have some frontend/backend interaction going on here where you have both client- and server-side validation. The widget thing that Larson had was a bit complex, but it does provide some good ideas as well. regards, Derick -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components
Re: [Components] [userinput] definition: required vs. optional
On Fri, 12 Dec 2008, Piotrek Karas wrote: > Just looking at the UserInput component for the first time, I completed > the tutorial sample code, seems to run fine, but I seem to have found > some inconsistencies: > > With definition: > > $definition = array( > 'firstName' => new ezcInputFormDefinitionElement( > ezcInputFormDefinitionElement::REQUIRED, 'string' ), > 'lastName' => new ezcInputFormDefinitionElement( > ezcInputFormDefinitionElement::REQUIRED, 'string' ), > 'age' => new ezcInputFormDefinitionElement( > ezcInputFormDefinitionElement::REQUIRED, 'int', array( 'min_range' => 1, > 'max_range' => 99 ), FILTER_FLAG_ALLOW_HEX ), > 'email' => new ezcInputFormDefinitionElement( > ezcInputFormDefinitionElement::REQUIRED, 'validate_email' ), > ); > > If I submit an empty form, "age" and "email" get [invalid] warning, and > "first name" and "last name" don't. > > 1) Since first and last name are REQUIRED, why is an empty string > interpreted as valid? REQUIRED means that the form that is sent should contain *a* value, not that it can't be empty. (We have a feature request for that at &activeItem=2) After that, the filter (string, int, validate_email) runs over it and might invalidate it. This happens for int (as an empty string is 0) and for email (because it can not be empty and needs to contain an @ etc). > 2) When I change REQUIRED to ezcInputFormDefinitionElement::OPTIONAL, > nothing seems to change. Correct, because I suppose in your case, all 4 form elements were actually sent. > So how do I make an e-mail field optional, as in "validate the field > if some value provided"? It doesn't seem to have any extra options to > control that... You are right here. REQUIRED and OPTIONAL are not as... inituitive as they should be unfortunately. regards, Derick -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components
[Components] remove dirs not used
Hello all, In our project we use _only_ the Graph's from the ezcomponents lib. Except the 'Graph' and the 'Base' directories, can I simply remove the other directories ? this would save me some space and some build/deploy time. thx Joao -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components
Re: [Components] remove dirs not used
Ho Joao, On 12/16/2008 06:41 PM Joao Ferreira gmail wrote: > In our project we use _only_ the Graph's from the ezcomponents lib. > Except the 'Graph' and the 'Base' directories, can I simply remove the > other directories ? You must keep - Base/ - Graph/ - autoload/ in place. Maybe also some of the Graph*Tiein packages, depending on if you use them. If not, they can savely be removed, too. HTH, Toby -- Mit freundlichen Grüßen / Med vennlig hilsen / With kind regards Tobias Schlitt (GPG: 0xC462BC14) eZ Components Developer t...@ez.no | eZ Systems AS | ez.no -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components
Re: [Components] New Component Proposal
On Mon, 15 Dec 2008, Alexandru Stanoi wrote: > How about CSS for the form? Also it should support different "renderers" > (HTML, templates, maybe smartphone forms?). I would agree, rending should be done through multiple renders. regards, Derick -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components
Re: [Components] New Component Proposal
On Mon, 15 Dec 2008, Kevin Waterson wrote: > This one time, at band camp, Alexandru Stanoi wrote: > > > Is it a good idea to depend on another component? (UserInput in this case). > > I was thinking on this, and the options seem to be to 'repurpose' UserInput > or to re-invent it again in ezcForm I wouldn't mind re-inventing it actually... UserInput is not the most useful or nicely implemented components. regards, Derick -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components
Re: [Components] [MvcTools] Sending HTTP status codes
Hans Melis wrote: > Is there some way to accomplish this? Derick, Is revision 9636 perhaps a response to this? :-) Regards, -- Hans -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components