Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


The signature of an AttrValidation is very specific, the name of the method needs to have the prefix 'validate' followed by the attribute name.
The parameter is an AttrChangeEvent which holds the old value and the new value as well as the Attribute and the Element. The AttrChangeEvent is imported from the package: 'org.adfemg.datacontrol.xml.events.AttrChangeEvent'.
Your method also needs to throw an AttrValException or an AttrSetValException which is an subtype of the AttrValException. Most of their constructors require a resource bundle (class), but their is one simple alternative without using a resource bundle as shown in the code example above. 
The method needs to have the annotation '@AttrValidation', after adding the annotation you should see an import appear from the class: 'org.adfemg.datacontrol.xml.annotation.AttrValidation'. 

Rebuild your Java class.
Now run the page.
You will notice that if you want to lower the salary and then press the submit button, you will get an error on the salary field:
 

...