Element_OphTrOperationnote_Anaesthetic::beforeValidate PHP Method

beforeValidate() public method

Validate the witness field if it's turned on.
public beforeValidate ( ) : boolean
return boolean
    public function beforeValidate()
    {
        if ($this->witness_enabled) {
            if ($this->anaesthetist_id == 3) {
                if (!$this->anaesthetic_witness_id) {
                    $this->addError('anaesthetic_witness_id', 'Please select a witness');
                }
            }
        }
        return parent::beforeValidate();
    }