I want to change the rendered form when I select type of the form. So, I use the following solution:
- Whenever user click to select a type (radio buttons), use jQuery to make an ajax call to write to the session the current selected type.
- In the view code, get the current selected type from the session, create the form of the current selected type, and return to the template.
For example, I have 2 type: teacher, and student. Teacher and Student form have different input fields: