开发者

How much flexibility it gives when you create a views using Zend forms and decorators

I need to create search view that contains 8 - 9 controls in a form. these controls are mixed type like text box, text area, combo box, check box and radio box. I also need to hide and show some of the controls based on previously selected values. There are some controls generated through ajax based on selected values. after search the same page show the result开发者_C百科s with pagination.

Can anybody let me know, should I use Zend forms and custom decorators or should I use normal html and Java Script to prepare this page. Which one is time saving job as I prefer later one.

I already have the page design in Static HTML.


My personal opinion (others may disagree) is, for a simple form, just use plain-old html (with or without Zend's view helpers). I've been using ZF for years now, and I simply cannot get to grips with (Zend) forms and decorators.

Just two weeks ago, I started on a new project, and said to myself "Right, time to use Zend forms and decorators." After one full working day of messing around yet-again with the documentation, tutorials, and whatever other resources I could get my hands on, I gave up (again) and an hour later my form was ready complete with client and server side validation and filtering, using the slighty more intuitive Zend_Filter_Input interface, and jQuery. The only thing 'fancy' I used in the view in which the form appeared was the view helpers, e.g.:

<?php echo $this->formText('username', isset($this->input) ? $this->input->username : '', array('size' => 32)) ?>
...
<?php echo $this->formText('email', isset($this->input) ? $this->input->email : '', array('size' => 32)) ?>
...
<?php echo $this->formSubmit('register', 'Register') ?>

But that is just my opinion, others may have had happy endings, but not me.


In reply to karim79's answer, it really depends. If you're used to Zend_Form or have enough time to dive in, then go for it, it is worth to do it as it could save you a lot of time in a near future. But it is really a matter of taste, if your design is good and you use view helper to manage your search form and so on, then go for it if you feel better with it. But be careful, doing such way can lead to messy code, even if it could be true with Zend_Form, it will impose you some rules through its design.

In your case, I'll personally go for custom elements/decorators and view helpers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜