# Field

### onFieldBeforeDelete

### onFieldAfterDelete

**Description**\
These events are triggered in `CompetitionModelField::delete` (admin). If the plugin returns `false` for `onFieldBeforeDelete` event then the field is not being deleted.

```php
public function onFieldBeforeDelete($context, $table)
{
    // Do something and abort delete
    return false;
}
```

**Arguments**\
`$context` - the context of the event, ‘com\_competition.field’.\
`$table` - a reference to CompetitionTableField object.<br>

### onFieldBeforeSave

### onFieldAfterSave

**Description**\
These events are triggered in `CompetitionModelField::save` (admin). If the plugin returns `false` for `onFieldBeforeSave` event then the filed is not being saved to the database.

```php
public function onFieldAfterSave($context, $table, $isNew)
{
    // Do something
    return;
}
```

**Arguments**\
`$context` - the context of the event, ‘com\_competition.field’.\
`$table` - a reference to CompetitionTableField object.\
`$isNew` - true for new field, false otherwise.

### onFieldChangeState

**Description**\
This evenr is triggered in `CompetitionModeField::publish` (admin) after field has its state changed.

```php
public function onFieldChangeState($context, $pks, $value)
{
    // Do something
    return;
}
```

**Arguments**\
`$context` - the context of the event, ‘com\_competition.field’.\
`$pks` - a list of the primary keys to change.\
`$value` - the value of the state.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.norrnext.com/norrcompetition/customisation/events/field.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
