Results 1 to 3 of 3

Thread: conditional field binding

  1. #1
    Join Date
    Feb 2010
    Posts
    5

    Default conditional field binding

    Hi,

    Annotated @InitBinder method lets me disallow some fields before binding and validation.

    Is there any way to force binding field A inside annotated @InitBinder method and based on this value disallow binding field B ?

    At a glance:
    Value of one field should determine binding another field.

    How can I achieve that?

    Greetings!

  2. #2
    Join Date
    Mar 2006
    Posts
    312

    Default

    Quote Originally Posted by fuss View Post
    Is there any way to force binding field A inside annotated @InitBinder method and based on this value disallow binding field B ?

    Code:
    @InitBinder
    public void init(WebDataBinder binder, @RequestParam("fieldA") Boolean fieldA) {
      if(fieldA) {
        //disallow fieldB from binder
      }
    }

  3. #3
    Join Date
    Feb 2010
    Posts
    5

    Default

    Works Great

    Thank You!

    Greetings!

Tags for this Thread

Posting Permissions

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