Changing Views Based On Mode
I am developing a widget using jquery ui. This widget is a survey creator. On one side, admin will be using this widget to create survey and the other end the same widget will be used by the end user to take the survey. So it will have multiple questions and choices. Data will be in the form of JSON.
With the Data,
I am rendering a lot of html on the page (just like a dynamic form).
My requirement is,
I just need to change the view(html) of the widget based on a property called mode.
ie., The JSON Data will be same on all modes. But based on the mode, the form should be changed.
For Example. On Edit mode, i need to display additional options, On Live mode, i need to hide the options, likewise i have 3 more mode. Each mode will have an impact on the view.
Is there any good approach for doing this? Any good design pattern?