Announcement Announcement Module
Collapse
No announcement yet.
Validation issue with CancellableFormController Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validation issue with CancellableFormController

    I am displaying a jsp with 1 textfield for user entry, and a Cancel and Save button. The controller is a CancellableFormController and I am validating the jsp with a Validator which implements the Validator class.

    If the user does not enter data in the input field and clicks Save, my code eventually enters the processFormSubmission() method which then redisplays the jsp with an error message. While I want the error message to display, within processFormSubmission I have my code to update my database. So the user sees an appropriate error, yet I will have updated my database with the bad data.

    Within processFormSubmission I could check whether there are errors before updating the database, but if the user corrects the field and hits Save again, I will never update the database because the BindingException errors are still present. How do I get around this catch-22?

    I can certainly post code if helpful.

    Thank you

  • #2
    Hi,

    If the user does not enter data in the input field and clicks Save, my code eventually enters the processFormSubmission() method which then redisplays the jsp with an error message.
    The very fact that the control is getting to the processFormSubmission method
    is most because of the following reasons.
    1. The Validator is not injected into the SimpleFormController
    2. The method of the form that is displayed to the user is not POST

    You are probably calling the validate method of the validator by yourself in the processFormSubmission

    Please post the controller code and the config file

    Comment

    Working...
    X