Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3939

@Bindable with validator allows incorrect behaviour on binding creation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7-rc-2
    • 1.8.1
    • None
    • None
    • Actually saw this in Griffon 0.3 snapshot, but is a @Bindable issue

    Description

      Currently a binding's validator only reacts to a change and is not given a chance to react to any initial data.

      Given:

      Model:

      @Bindable String data = 'x'
      

      View:

      textField(id: 'port', columns: 5, text: bind(source: model, 'port',
      mutual: true, validator: { isInteger(port) }))
      

      As created, the textField will contain 'x', even though an isInteger validator method (assuming one exists and is correct) would reject it. If 'y' is subsequently typed into the field, the validator will run and will (presumably)reject the contents.

      More discussion and workaround here: http://archive.codehaus.org/lists/org.codehaus.griffon.user/msg/001701ca7885$a4925f40$edb71dc0$@com.au

      Attachments

        Activity

          People

            aalmiray Andres Almiray
            alpheratz alpheratz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: