HTML / JS helpers - does it worth using?

I know it might sound stupid, but does it really worth using HTML / JavaScript helpers? I mean CHtml, Zii and other classes.

I understand that it’s shorter (and maybe for some, it’s also easier) to write code with these helpers, but I think it has some disadventages as well:

  • not sure if it’s “good” to write PHP code in view, so instead of CHtml instances it might be preferable to write pure HTML.

  • AFAIK Yii doesn’t support HTML5 yet, so if for example I want to generate a form with Yii’s helpers it won’t be valid HTML5.

  • New version of jQuery is always coming out which means that if we use Yii’s helpers we don’t necessarily use the latest one.

  • We "have to" study how to use these helpers. While most people knows how to write pure HTML and jQuery code, we have to learn how to use these functions.

AFAIK Zend is also not going to have jQuery helpers in ZF2 for some reason while they used to have it (ZendX jQuery) in previous versions.

My question is, what’s the point of using these helpers? Is it that it’s easier and quicker to use (once you got to learn them) or are there any more adventages?

Of course… you can just write your HTML without any problem…

But in the case of CActiveForm… you get automatic variable naming, client and server side validation declared only once in the validation rules, safe attributes… if you would do that all manually… you would need to pay attention to variable input names… check what variables can be assigned… write your client side validation…

So in the end… these are helpers… you can use them… or not… :)

I don’t like the Active form because it is primitive…

It should come with some nice ajax validation built in… IMHO :)

What do you mean with nice ajax validation ???

CActiveForm does have ajax validation together with client side validation is a very handy stuff… .as they are both configured with the validation rules…

mdomba This could be useful http://www.yiiframework.com/extension/ajaxvalidationmessages/ if was built in