Prefer old input data over form field values.

This commit is contained in:
Franz Liedke committed 2013-03-20 23:53:57 +01:00
1 parent cd84f672c7
commit fc025c0876
1 file changed
+6 -2
+6 -2
View File
@@ -658,19 +658,23 @@ class FormBuilder {
/** /**
* Get the value that should be assigned to the field. * Get the value that should be assigned to the field.
* *
* This returns either old input for this field, the
* value passed to this method or the equally-named attribute of the
* current model instance (in this order of precedence).
*
* @param string $name * @param string $name
* @param string $value * @param string $value
* @return string * @return string
*/ */
protected function getValueAttribute($name, $value) protected function getValueAttribute($name, $value)
{ {
if ( ! is_null($value)) return $value;
if (isset($this->session) and $this->session->hasOldInput($name)) if (isset($this->session) and $this->session->hasOldInput($name))
{ {
return $this->session->getOldInput($name); return $this->session->getOldInput($name);
} }
if ( ! is_null($value)) return $value;
if (isset($this->model) and isset($this->model[$name])) if (isset($this->model) and isset($this->model[$name]))
{ {
return $this->model[$name]; return $this->model[$name];