Excerpt |
---|
|
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 |
---|
nopanel | true | Common Model Hook Attributes |
---|
|
...
Example #1 - entity validation
Code Block |
---|
theme | Eclipse |
---|
language | xml |
---|
linenumbers | true |
---|
|
<hooks>
<validatesWith class="com.sample.SampleHook" method="entityHookName" />
</hooks> |
Hook method signature for example #1
Code Block |
---|
theme | Eclipse |
---|
language | java |
---|
linenumbers | true |
---|
|
public boolean entityHookName(final DataDefinition dataDefinition, final Entity entity) {
// ...
} |
Example #2 - field validation
Code Block |
---|
theme | Eclipse |
---|
language | xml |
---|
linenumbers | true |
---|
|
<string name="someField">
<validatesWith class="com.sample.SampleHook" method="checkIfFirstnameMatchesGenderfieldHookName" />
</string> |
...
Hook method signature for example #2
Code Block |
---|
theme | Eclipse |
---|
language | java |
---|
linenumbers | true |
---|
|
public boolean hookNamefieldHookName(final DataDefinition dataDefinition, final FieldDefinition fieldDefinition, final Entity entity, final Object fieldOldValue, final Object fieldNewValue) {
// ...
} |