I am looking for some implementation ideas.
A view has a dropdown. After selecting a value in the dropdown and clicking a submit button, the form gets submitted and calls a method in the view's controller. This method would display a table of data in the same view depending upon the selection made in the drop down. This works fine.
There is another case where in the dropdown in the view can have a value preselected by using some cookies set on the browser. So now, even without clicking the submit button, the above mentioned method in the controller should be called and a table of data should be displayed according to the default value selected in the dropdown. How can this be achieved?
Given you are looking for idea, here is a few:
- Have your controller check for the cookie, and run the required code just as if the page had been submitted and return the desired result
Hope that has helped