Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Excerpt
hiddentrue

onCopy validatesWith - fired to validate entity or field.

Overview

Event fired to If defined inside <hooks  /> element - validate whole entity.,
If defined inside field element - validate field value

Common Attributes

Insert excerpt
Common Model Hook Attributes
Common Model Hook Attributes
nopaneltrueCommon Model Hook Attributes

...

Example #1 - entity validation

Code Block
themeEclipse
languagexml
linenumberstrue
<hooks>
    <validatesWith class="com.sample.SampleHook" method="entityHookName" />
</hooks>

Hook method signature for example #1

Code Block
themeEclipse
languagejava
linenumberstrue
public boolean entityHookName(final DataDefinition dataDefinition, final Entity entity) {
    // ...
} 

Example #2 - field validation

Code Block
themeEclipse
languagexml
linenumberstrue
<string name="someField">
    <validatesWith class="com.sample.SampleHook" method="checkIfFirstnameMatchesGenderfieldHookName" />
</string>

...

Hook method signature for example #2

Code Block
themeEclipse
languagejava
linenumberstrue
public boolean hookNamefieldHookName(final DataDefinition dataDefinition, final FieldDefinition fieldDefinition, final Entity entity, final Object fieldOldValue, final Object fieldNewValue) {
    // ...
}