CalculatorForm::Form_Validate PHP Method

Form_Validate() protected method

protected Form_Validate ( )
    protected function Form_Validate()
    {
        // Add a Custom Form Validation rule here
        // If we are Dividing and if the divisor is 0, then this is not valid
        if ($this->lstOperation->SelectedValue == 'divide' && $this->txtValue2->Text == 0) {
            // Warnings and Errors are rendered the same way by RenderWithError()
            $this->txtValue2->Warning = 'Cannot Divide by Zero';
            // We need to make sure the QForm knows that this form is not valid
            // We do this by returning false
            return false;
        }
        // If we're here, then the custom Form validation rule validated properly
        // Therefore, return true
        return true;
    }