src/flowcode/roble/form/BaseForm.php
public function isValid() {
        $valid = TRUE;
        foreach ($this->fields as $key => $field) {

            // required
            if ($field->getOption("required") && $field->getValue() == "") {
                $this->errors[$key] = "Requerido";
                $valid = FALSE;
            }

            // custom validators
            if (isset($this->validators[$key])) {

                foreach ($this->validators[$key] as $validator) {

                    $validator->validate($field);
                    if (!$validator->isValid()) {
                        $this->errors[$key] = $validator->getMessage();
                        $valid = FALSE;
                    }
                }
            }
        }
        return $valid;
    }
public function isValid() {
        $valid = TRUE;
        foreach ($this->fields as $key => $field) {

            // required
            if ($field->getOption("required") && $field->getValue() == "") {
                $this->errors[$key] = "Requerido";
                $valid = FALSE;
            }

            // custom validators
            if (isset($this->validators[$key])) {

                foreach ($this->validators[$key] as $validator) {

                    $validator->validate($field);
                    if (!$validator->isValid()) {
                        $this->errors[$key] = $validator->getMessage();
                        $valid = FALSE;
                    }
                }
            }
        }
        return $valid;
    }
public function isValid ( ) { $ valid = TRUE ; foreach ( $ this -> fields as $ key => $ field ) { // required if ( $ field -> getOption ( "required" ) && $ field -> getValue ( ) == "" ) { $ this -> errors [ $ key ] = "Requerido" ; $ valid = FALSE ; } // custom validators if ( isset ( $ this -> validators [ $ key ] ) ) { foreach ( $ this -> validators [ $ key ] as $ validator ) { $ validator -> validate ( $ field ) ; if ( ! $ validator -> isValid ( ) ) { $ this -> errors [ $ key ] = $ validator -> getMessage ( ) ; $ valid = FALSE ; } } } } return $ valid ; }
Verify each field with its correspondant validator, if exist.
@return boolean
Verify each field with its correspondant validator if exist .