diff --git a/src/FormElement/FormElements.php b/src/FormElement/FormElements.php index 0e93f7fa..d8bb784c 100644 --- a/src/FormElement/FormElements.php +++ b/src/FormElement/FormElements.php @@ -337,6 +337,22 @@ public function getPopulatedValue($name, $default = null) : $default; } + /** + * Clear populated value of the given element + * + * @param string $name + * + * @return $this + */ + public function clearPopulatedValue($name) + { + if (! $this->hasBeenSubmitted() && isset($this->populatedValues[$name])) { + unset($this->populatedValues[$name]); + } + + return $this; + } + /** * Add all elements from the given element collection *