This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
dev.mnr.j20762
I am having the error << Unknown "old" function. Did you mean "placeholder"? >> when I try to get old input values of my form.
My input field code at the front-end is like that:
<div class="required form-group">
<label for="name">Full name</label>
<span class="input-wrapper">
<input type="text"
name="name"
class=" form-control"
value="{{ old('name') }}"
>
</span>
</div>
At the backend, when validator fails, I redirect the request like that:
if ($validator->fails()) {
// The given data did not pass validation
return Redirect::back()
->withInput()
->withErrors($validator);
}
Last updated
dev.mnr.j20762
This is my solution ->
Instead of using old('name')
I now use form_value('name')
and it works.
jc91715
try this?
$this->controller->getTwig()->addFunction(
new \Twig_SimpleFunction(
'old', function () {
return request()->old(func_get_arg(0));
}
)
);
Mennax
dev.mnr.j20762 said:
Instead of using
old('name')
I now useform_value('name')
and it works.
Thanks, it works!
Last updated
1-4 of 4