Sticky forms in laravel 5

Published 2 years ago by vk011

Hi guys, In Laravel 5 form helper does not exist anymore, so what is the best way to make forms sticky, so for example if validation fails for one input but is ok for another, the ok one should be remembered. I remember this was automatic with the html helper, but I wanna know if know there is another way since html helper is not part of laravel core anymore?

Best Answer (As Selected By vk011)
SaeedPrez
<input type="text" name="username" value="{{ old('username') }}">

source

You can also provide a default value as a second parameter.

<input type="text" name="username" value="{{ old('username', 'default') }}">
nate.a.johnson
SaeedPrez
<input type="text" name="username" value="{{ old('username') }}">

source

You can also provide a default value as a second parameter.

<input type="text" name="username" value="{{ old('username', 'default') }}">
Snapey
Snapey
2 years ago (993,685 XP)

What @SaeedPrez said, but also noting that 'default' can be data from the model when you are editing

<input type="text" name="username" value="{{ old('username', $user->name) }}">

Please sign in or create an account to participate in this conversation.