Announcement Announcement Module
Collapse
No announcement yet.
<form:select problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • <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
    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, 02:38 PM.

    Comment


    • #3
      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

      Comment


      • #4
        Originally posted by 4seasons View Post
        what do you mean by automatic validation?
        BaseCommandController's setValidateOnBinding() The default is true, I believe.

        Comment

        Working...
        X