Results 1 to 6 of 6

Thread: onFormChange in Simple Form Controller

  1. #1
    Join Date
    May 2010
    Posts
    7

    Question onFormChange in Simple Form Controller

    Can i modify text boxes values(in form) when a user has entered his username in a text filed using onForm Change ? like as in ajax scripts related fields are populated onchange of username field ?

    If so can anyone tell how to use this method ? is it like formbacking object method ?
    can any one give an example of this method i couldnt find it on net
    Last edited by kantu; May 17th, 2010 at 10:29 AM.

  2. #2
    Join Date
    May 2010
    Posts
    7

    Default

    Could some one plz tell how to use onFormChange method ??? i couldnt find any documentation on it

  3. #3
    Join Date
    May 2005
    Posts
    288

    Default

    Actually, the JavaDoc for SimpleFormController documents the method quite well: http://static.springsource.org/sprin...ontroller.html. Make sure to read the workflow description.
    The usual workflow after the form is displayed and submitted is to go either back to the form in case of errors or to go to the success page.
    Now, onFormChange allows you to do something on the server-side and to go back to the form with binding, but without validation.
    A good example would be a form for a list of order items: A button "add 5 more items" should be detected by your implementation of isFormChangeRequest(). Then your implementation of onFormChange would add 5 new empty items to the list in your form backing object. Everything else would be handled by SimpleFormController.

    HTH

  4. #4
    Join Date
    May 2010
    Posts
    7

    Default

    Ok i tried this in onFormChange method
    Code:
    onFormchange(){
    if(request.getParameter("username")!=null){
    //make all the form changes 
    }
    }
    But this works only on submit, how can i make it happen as and when the fields are modified

  5. #5
    Join Date
    May 2010
    Posts
    1

    Default

    even i'm stuck with a similar problem, i need to change the form .. could u please provide a sample code for implementation of onFormChange() method..

    Thanks!

  6. #6
    Join Date
    May 2005
    Posts
    288

    Default

    @kantu: This is server-side-code only and has nothing to do with AJAX. What you do in onFormChange, will only happen after the form has been submitted.

    @lazyfrog: http://www.jroller.com/Solomon/entry...mic_collection

    HTH

Posting Permissions

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