Prevent EVENT_BEFORE_VALIDATE in specific case I have a registration form and its custom validation in PHP plugin code.

However, the validation works when user set a new password.
I supposed that $event->isNew is good to detect if it is a new user registration or not, but the element does not work.
Craft says it is unknown property.

Could you tell me how to detect the kinds of submission?

// Registration Form
$request = Craft::$app-&gt;getRequest();
Event::on(
    User::class,
    Element::EVENT_BEFORE_VALIDATE,
    function (Event $event) use($request) {
        // If a user already logged in we are not on the public registration page
        if (Craft::$app-&gt;getUser()-&gt;getIdentity()) return;

        if (!$event-&gt;isNew) return;

        // Do the custom validation
        if (!$event-&gt;sender-&gt;firstName) {
            $event-&gt;sender-&gt;addError('firstName', Craft::t('yii', '{attribute} cannot be blank.', [ 'attribute' =&gt; Craft::t('app', 'First Name') ]));
            $event-&gt;isValid = false;
        }
...
First, you should test the sender property pointing to the User element. 

Second, there's no such property as isNew in that case.

However, you could test that user is new given that its ID won't be set in case the user has not been saved yet.

Something like:

Event::on(
    User::class, // \craft\elements\User
    User::EVENT_BEFORE_VALIDATE,
    function (\yii\base\ModelEvent $event) {
        $sender = $event-&gt;sender;
        Craft::debug("User " . ($sender-&gt;id ? "already exists" : "is new"), __METHOD__);
    }
);