About form error, is it possible to add a certain class like 'invalid' on the input/select/raido itself?

from this document formElementErrors - laminas-form - Laminas Docs
I learn to write my own form error helper.

However I have a special requirement that, I need to add a special class like ‘invalid’ on the form element itself, for example onside the input element, not after it. Is it possible to fulfil?

If you use the “FormRow” help and there are errors, the class input-error is already set.
This can be customised in a view-script via:

$this->formRow()->setInputErrorClass('is-invalid');

Which form view helpers do you use?

I usually use this way <div class="hcs-inner-col2"><?= $this->formInput($this->form->get('accountname')); ?></div>

So this way, it won’t add input-error to input element itself?
What’s the differences between $this->formRow() and $this->formInput().

By the way, I usually use the form like follow to built my form elment:

    $this->add([
            'name' => 'servername', 
            'type' => Text::class,
            'attributes' => [
                'id' => 'servername',
                'placeholder' => 'pls add a servername',
            ],
        ]);

It is possible to add errorclass here? ok forget about it, I can change the invalid class to input-error.

So it is possible to show the input-error when I use this way <div class="hcs-col2"><?= $this->formInput($this->form->get('servername')); ?></div>