I have been struggling with this simple problem for some time now. I have a table in my DB which has a column named Year. What I would like to do is to have a view (website) which has a simple dropdown list containing the distinct years in.
Making a selection in the dropdown would reload the page with that year as the parameter.
So my questions are:
[list=1]
[*] How do you make an ActiveForm without a model?
[*] How do I can I get the distinct years from the column (it contains double entries)?
[*] How do I get the dropdown to appear in the view with the corresponding actions?
What I basically want is get all the distinct years from my column, show them in a dropdown and reload the page after another year (from those years from that column) is selected (the page show relevant information for that year).
I can create a model for it, but I found it too cumbersome and to much boiler plate code for such an easy functionality?
Yes, you should create a model for your db table using Gii’s model generator, and also you should create CRUD pages for that model. It’s the easiest way.