YII found wanting

Maybe its me - maybe it isn't - but though I appreciate a lot of people are getting on famously with this framework I personally am finding more things missing from Yii to make it into my "must have" frameworks.

It's primarily in the construction of dropdown lists. Dates being the biggest bugbear. There doesnt seem to be a standard method for creating them, unless I want to bloat out my templates or spend a load of time creating widgets/portlets/helpers or whatever the buzzword happens to be with Yii for said form control. Surely any self-respecting framework would have a dropdown list method sitting in the core.

Additionally, when a form is posted, dropdown lists are not automatically assigned the same selected options from the originally posted form.

Maybe I'm missing a trick - or half a dozen - but for me Yii is somewhat lacking to be a serious contender in the PHP Framework world. I may return to this in a few months when it's matured and offers proper RAD. In the meantime I'll stick with any of the more mature frameworks available.

If you are looking for a datepicker, you may take a look at our extension repository. Our philosophy is that we would keep the core as light and stable as possible and enrich the features in terms of extensions.

Regarding dropdown selection persistence, Yii's CHtml helper does provide that. Maybe you have misused it?

The date picker is simply the Jquery UI datepicker object which is a very nice looking widget, however wholly impractical for far future or far past dates, such as collecting a date of birth. To do so a new user to a site must first familiarise themselves with the datepicker ui and then slowly work out how to select the year, month and day from said picker.

3 dropdown lists are not only more user friendly, but also intuitive especially for people new or ever so slightly unfamiliar with entering data into a web form.

I find that a lot of frontend designers to assume that every single visitor to their site will have years of web browsing under their belt, however when we have used javascript widgets in place of the more traditional methods we tend to lose the newer internet user due to complex or overly engineered forms.

I would have thought that date/time fields were quite common use on sites, and other framework developments accept that indeed they are, and so consequently have a date drop down list as standard. To use a javascript date picker is fine, provided you know your demographic are going to know exactly what to do with it when presented with it.

I realise this may just be me, so I put it to a few other collegues and they have agreed that a date picker as 3 standard select drop downs is the "norm" and a datepicker widget is just trying to be clever. Also the amount of javascript required to display a datepicker is overkill just to get a value of ####-##-##

The idea of 3 drop downs may seem antiquated to most of us, however when we see more and more older people getting themselves onto the net we need to be able to present them with familiar controls, not just the ones we think look cooler.

I'm not trying to create a meaningless flame against Yii, I am simply pointing out that I agree that a light framework is definitely the way to go, however the framework should at least give the grassroots in helpers to expidite the delivery of a site. Almost all other frameworks have such a thing, for me it makes Yii stand out in a bad way due to it's lack.

If you want "easy" to understand and use birth dates. Use three form fields without drop down.

If you want could do it even with out special signs like /. Cause a date in three "fields" is so common. That every further information is just noise ( Annoying ) Or you let the user enter the dots like 04.04.2009. With a format information. You should set the format inforamtion the right of the fields. So it could be ignored by "pro" users :slight_smile:

This is exactly what I'm pointing at. However it wouldn't just be birth dates - this was just an example since clicking endlessly to get to 1 year, then 1 month, then 1 day seems rather drawn out.

My "complaint" was that Yii wont recognise a date/time field from a database table even in scaffold and generate the 3 appropriate dropdown lists unlike any other frameworks which do. I dont see why the MVC portion (that's the bits we would extend Yii from to generate our glorious creations) would require a bunch of heavy lifting. Surely the premise that the core should have such a helper isn't that obscure?

What would be wrong with adding to the core CHtml::activeDropDownDateStamp() as an example?

Sure I could use a text field - 3 even - but the idea is to surely reduce the amount a user has to not only click, but also type in a form. The idea is to get past a form and to the end result as quickly a possible. UK and US date formats differ slight in that you would have DD-MM-YYYY for the UK and MM-DD-YYYY for the US. MySQL goes one further of YYYY-MM-DD. So one needs to assume that your site users are "date aware". Most of us are, but most of us are not the average site user.

Maybe I'm just beating my head against the wall on this. But personally it's what puts me off Yii. A standard helper found in practically all other frameworks. I'm truely sorry if I'm coming across as a picky s.o.b, but I love the idea of Yii, but from a practical RAD this one feature - among a few others - leave me reaching for a framework with richer form generation.


What would be wrong with adding to the core CHtml::activeDropDownDateStamp() as an example?

You could extend CHtml to include such a method.  Or you could write a MyDateClass that will do this pus an number of other date-related things your app needs.

In general, anything a toolset does for you is also something the toolset does to you as well.  You would probably be happiest with your own implementation.  Do you want Drop downs, spin boxes, or fill ins, or do you want this to be configurable?  Do you want names, or numbers for the month, or do you want this to be configurable.  Do you want the day first (as in Europe), the month first as in the U.S, or do you want this to be configurable?  For everybody who thinks Yii's implementation, another 10 would react with a hearty "Why in perdition did they do THAT.  That real problem is:  that would be true no matter what implementation was chosed for Yii.  Every substantial toolset I've seen had features where my reaction was "Ugh, I don't want to use THAT feature.


My "complaint" was that Yii wont recognise a date/time field from a database ....table

You can write beforelLoad() and afterLoad() methods in your User class which splits and reunites the values appropriately.  You can extend the User class to make these functions generally available to your app. 


Our philosophy is that we would keep the core as light and stable as possible and enrich the features in terms of extensions.

Well, I think that the basic DataBase Types should be handled by forms through built-in classes, not extensions. I think 'DateTime' fields are used in most databases and it would simplify things if there would be a CHTML::activeDateTimeField

The field itself would simply be a textfield, but it's value would be set through a JavaScript datepicker.