Results 1 to 4 of 4

Thread: <form:select problem

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Posts
    12

    Default <form:select problem

    guys

    i have a problem with <form:select tag. I have a <form:select tag for which the options are supplied through a dynamic collection from the request scope. When i submit the form and if the validation fails, the value i chose when i submit the form gets reset and it always shows the first option in the drop down..

    but if i supply the values with each <form: option tag statically, it retains. the issue is only if the values are supplied dynamically which is what i need as well..

    any clue ...whats going on?

  2. #2
    Join Date
    Jun 2005
    Location
    Saint Louis, Missouri
    Posts
    45

    Default

    Are you using automatic validation? If you are, then I don't think you have to do anything special...your "formView" should have the form available -- unless it is doing a redirect (though I can't see a reason why someone would do that, but it is possible).
    Code:
    <property name="formView" value="mybodyT" />
    or
    <property name="formView" value="redirect:/s/something.html" />

    In our controllers when we're NOT using automatic validation, we generally do something like
    Code:
            getValidator().validate(form, errors);
            if (errors.hasErrors()) {
                return showForm(request, response, errors, errors.getModel());
            }
    Thoug I might add that our HTML elements (like select lists, etc) have their data created by the referenceData() method and showForm eventually calls referenceData(). (high level Live cycle visio/jpeg available upon request)
    Last edited by travism; Jun 30th, 2008 at 01:38 PM.
    "Yay for the mainframe..."

  3. #3
    Join Date
    Aug 2007
    Posts
    12

    Default

    Quote Originally Posted by travism View Post
    Are you using automatic validation? If you are, then I don't think you have to do anything special...your "formView" should have the form available -- unless it is doing a redirect.
    Code:
    <property name="formView" value="mybodyT" />
    or
    <property name="formView" value="redirect:/s/something.html" />

    In our controllers when we're NOT using automatic validation, we generally do something like
    Code:
            getValidator().validate(form, errors);
            if (errors.hasErrors()) {
                return showForm(request, response, errors, errors.getModel());
            }
    Thoug I might add that our HTML elements (like select lists, etc) have their data created by the referenceData() method and showForm eventually calls referenceData(). (high level Live cycle visio/jpeg available upon request)
    what do you mean by automatic validation? I have a validator class in which i am doing the validation in validate(Object command, Errors errors) method

  4. #4
    Join Date
    Jun 2005
    Location
    Saint Louis, Missouri
    Posts
    45

    Default

    Quote Originally Posted by 4seasons View Post
    what do you mean by automatic validation?
    BaseCommandController's setValidateOnBinding() The default is true, I believe.
    "Yay for the mainframe..."

Posting Permissions

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