Results 1 to 5 of 5

Thread: SimpleFormController and binding errors

Hybrid View

  1. #1
    Join Date
    May 2005
    Posts
    1

    Default SimpleFormController and binding errors

    Hi all,

    I have a problem with the binding error message.

    I use a SimpleFormController. In the form, user can do actions which require no validations (isFormChangeRequest to determine it). When he valids, this works fine. When he changes the form, it's ok, except that binding error message appears...

    Binding is done before validation, so if a user change the form with wrong datas in fields, he gets an error message.

    Exemple :
    - Type 'test' in a field bind with a CustomDateEditor
    - Click on change form button
    - Page reload (no validation)
    - The error message for an invalid date appears.... not wanted because no validations has been done.

    I don't want to show this message, because it's not a validation.

    How can i do to remove these error messages in a proper way ?
    Can i ignore them ?

    Thx

    PS : sorry for my bad english i'm not an english speaking

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    Type 'test' in a field bind with a CustomDateEditor...The error message for an invalid date appears....not wanted because no validations has been done
    This is the way Spring works. Validation on a date is meaningless if the input cannot be converted to an actual date.

  3. #3

    Default

    I feel this is all too easy. The problem has been raised a couple of times before with the same answer each time. An invalid date is to me also a kind of validation error (typically wrong format). I do understand that the command object cannot be completely created out of the data of the form when binding errors occur, but that doesn't matter much.

    Even worse, if you want to remove the command object from the session (with session form = true) and then redirect to another page, the user MUST correct the date even if you (and especially the user) don't care.

    Cheers, Stefaan.

  4. #4
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    The problem has been raised a couple of times before with the same answer each time.
    This isn't a problem. Spring behaves as expected. What would you expect to happen if an invalid date is entered?

    An invalid date is to me also a kind of validation error (typically wrong format).
    Which is why Spring raises the exception for you.

    Even worse, if you want to remove the command object from the session (with session form = true) and then redirect to another page, the user MUST correct the date even if you (and especially the user) don't care.
    You can always allow the user to click on another link and remove the object from the session manually.

  5. #5

    Default

    Quote Originally Posted by katentim
    The problem has been raised a couple of times before with the same answer each time.
    This isn't a problem. Spring behaves as expected. What would you expect to happen if an invalid date is entered?
    Well, I would expect the same possibilities as validation, so a supressBinding() for example next to a supressValidation().

    Quote Originally Posted by katentim
    An invalid date is to me also a kind of validation error (typically wrong format).
    Which is why Spring raises the exception for you.
    Yes, but that's different from validation which you can turn off. If there is a binding error, Spring won't go into the onSubmit() method.

    Quote Originally Posted by katentim
    Even worse, if you want to remove the command object from the session (with session form = true) and then redirect to another page, the user MUST correct the date even if you (and especially the user) don't care.
    You can always allow the user to click on another link and remove the object from the session manually.
    Unfortunatly that is not that easy, especially if you want to allow the user to have multiple windows open (in firefox this doesn't cause a new session). Going through the same controller avoids this problem, but it would be convenient to turn off binding as you would turn off validation.

    This would make solutions as discussed in for example the thread http://forum.springframework.org/viewtopic.php?t=4713 more correct !

Similar Threads

  1. Replies: 4
    Last Post: Oct 26th, 2009, 08:58 AM
  2. Replies: 7
    Last Post: Sep 13th, 2005, 01:45 AM
  3. Replies: 0
    Last Post: Jan 6th, 2005, 08:19 AM
  4. Binding errors in 1.1 RC1+
    By dmiller in forum Web
    Replies: 3
    Last Post: Aug 17th, 2004, 09:33 PM
  5. Replies: 2
    Last Post: Aug 17th, 2004, 04:16 PM

Posting Permissions

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