src/Form.php
public function loadPOST()
    {
        $post = $_POST;

        $this->hook('loadPOST', [&$post]);
        $errors = [];

        foreach ($this->fields as $key => $field) {
            try {
                $value = isset($post[$key]) ? $post[$key] : null;

                // save field value only if field was editable in form at all
                if (!$field->readonly && !$field->disabled) {
                    $this->model[$key] = $this->app->ui_persistence->typecastLoadField($field->field, $value);
                }
            } catch (\atk4\core\Exception $e) {
                $errors[$key] = $e->getMessage();
            }
        }

        if ($errors) {
            throw new \atk4\data\ValidationException($errors);
        }
    }
public function loadPOST()
    {
        $post = $_POST;

        $this->hook('loadPOST', [&$post]);
        $errors = [];

        foreach ($this->fields as $key => $field) {
            try {
                $value = isset($post[$key]) ? $post[$key] : null;

                // save field value only if field was editable in form at all
                if (!$field->readonly && !$field->disabled) {
                    $this->model[$key] = $this->app->ui_persistence->typecastLoadField($field->field, $value);
                }
            } catch (\atk4\core\Exception $e) {
                $errors[$key] = $e->getMessage();
            }
        }

        if ($errors) {
            throw new \atk4\data\ValidationException($errors);
        }
    }
public function loadPOST ( ) { $ post = $ _POST ; $ this -> hook ( 'loadPOST' , [ & $ post ] ) ; $ errors = [ ] ; foreach ( $ this -> fields as $ key => $ field ) { try { $ value = isset ( $ post [ $ key ] ) ? $ post [ $ key ] : null ; // save field value only if field was editable in form at all if ( ! $ field -> readonly && ! $ field -> disabled ) { $ this -> model [ $ key ] = $ this -> app -> ui_persistence -> typecastLoadField ( $ field -> field , $ value ) ; } } catch ( \ atk4 \ core \ Exception $ e ) { $ errors [ $ key ] = $ e -> getMessage ( ) ; } } if ( $ errors ) { throw new \ atk4 \ data \ ValidationException ( $ errors ) ; } }
Looks inside the POST of the request and loads it into a current model.
Looks inside the POST of the request and loads it into a current model .