Archive

Posts Tagged ‘zend_form’

Inline Zend Form Hints

August 16th, 2010 Adrian 4 comments

One thing I always enjoy on sites is when they use the inline hints on text elements. Once you click on the element, the text disappears, and typically re-appears when it loses focus again, assuming it’s still empty. Semantically, these have quite a different meaning than what a description is, so it’s nice to also give users an example of the data, or an explanation of what you expect them to enter. This is a huge help when you require certain formats of data (URLs, emails, dates, etc.)

I’ve been messing around with my base Zend_Form class and came up with a solid implementation now. I’ve also expanded the concept to select elements, in which case it’d create a zero-value option with your hint. This entire inline hint concept is enabled by JavaScript (in this case, jQuery), so when JavaScript is not enabled, nothing different will happen for users. I think that’s ideal. Read more…

Caching Zend Framework Forms

February 10th, 2010 Adrian 4 comments

Generating a form is an expensive process in ZF. It’s always bugged me that I can’t find any resources on trying to cache the initial HTML anywhere, so I took a stab at it myself. I use a loader from inside my controller action to load forms and models, so I found that was a good place to start.

Here is my initial loader class, which I have stripped down and simplified for the sake of this example. Ideally, you’d want this in something like an action helper. Read more…

Forms in Zend Framework

February 9th, 2010 Adrian 10 comments

I’m often asked what my favorite component of Zend Framework is, and I invariably answer: “Forms”. Forms have always played an awkward role in the model-view-controller paradigm. Sure, the form is just HTML, but to me, it represents something more abstract than that. It represents the HTML form itself, taking user input, normalizing and validating it, and also being able to show the form again when errors occur. This can take quite a large amount of code. Read more…

Categories: Development, Zend Framework Tags: , ,