Announcement Announcement Module
Collapse
No announcement yet.
Spring 3.0 Dynamic MVC question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3.0 Dynamic MVC question

    Hi,

    I am trying to find an example or figure out what the correct way to implement the following dynamic form should work.

    I have a simple form where I have a select box with a list of states. Lets say for Arizona I want to display field1, field 2, field3. If the user selects California I will show fieldX, fieldY, fieldZ. The correct fields to display comes from the database. Can someone please help me decide how to set up my model , view, and controller?

    Any suggestions/examples would be appreciated.

    Thanks

  • #2
    First you are going to have to pick between one of two options based on what happens when a user picks an item.
    1) When the user picks a state, a Javascript event runs that displays the hidden form elements.
    2) when the user picks a state, a javascript event runs that uses ajax to call back to the webserver to determine which fields to display.

    If (1), your controller has to get all the field info into the model and then send that info to the view for encoding into the javascript.

    If (2), you will need a controller to handle the ajax callback. The view for this can be a html snippet containing the new form elements.

    Comment


    • #3
      Thanks for the reply.

      I dont mind doing a form submit when the state is changed.

      I was mainly wondering if there was a Spring 3.x way to create a dynamic model then bind it to a dynamic form.

      Comment

      Working...
      X