Results 1 to 3 of 3

Thread: Spring 3.0 Dynamic MVC question

  1. #1
    Join Date
    Jan 2011
    Posts
    6

    Default 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. #2
    Join Date
    Jan 2011
    Posts
    6

    Default

    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.

  3. #3
    Join Date
    Jan 2011
    Posts
    6

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •