public function populateFields()
    {
        if (count($this->submittedData) < 1) {
            return;
        }
        array_map(
            function (FormField &$field) {
                if (isset($this->submittedData[$field->getName()])) {
                    $raw = $this->submittedData[$field->getName()];

                    $sanitized = $field->sanitize($raw);
                    $field->setValue($sanitized);
                } else {
                    // Unset value (see: checkboxes where value only sent when checkbox was checked
                    if ($field->getType() == FormField::TYPE_CHECKBOX) {
                        $field->setValue(null);
                    }
                }
            },
            $this->getFields()
        );
    }
public function populateFields()
    {
        if (count($this->submittedData) < 1) {
            return;
        }
        array_map(
            function (FormField &$field) {
                if (isset($this->submittedData[$field->getName()])) {
                    $raw = $this->submittedData[$field->getName()];

                    $sanitized = $field->sanitize($raw);
                    $field->setValue($sanitized);
                } else {
                    // Unset value (see: checkboxes where value only sent when checkbox was checked
                    if ($field->getType() == FormField::TYPE_CHECKBOX) {
                        $field->setValue(null);
                    }
                }
            },
            $this->getFields()
        );
    }
public function populateFields ( ) { if ( count ( $ this -> submittedData ) < 1 ) { return ; } array_map ( function ( FormField & $ field ) { if ( isset ( $ this -> submittedData [ $ field -> getName ( ) ] ) ) { $ raw = $ this -> submittedData [ $ field -> getName ( ) ] ; $ sanitized = $ field -> sanitize ( $ raw ) ; $ field -> setValue ( $ sanitized ) ; } else { // Unset value (see: checkboxes where value only sent when checkbox was checked if ( $ field -> getType ( ) == FormField :: TYPE_CHECKBOX ) { $ field -> setValue ( null ) ; } } } , $ this -> getFields ( ) ) ; }
populates form from POST after submission
populates form from POST after submission