Form old values #3485
-
It would be nice to get the old user-entered values from the form after the user has confirmed the form submission and got redirected back due to errors in the form. In general, they can be obtained from flashMessages using the get() method with an empty string as the second argument. But there is a catch, if the user does not enter anything and sends the data, then after the redirect back, the field will contain null. Example: <input type="email" class="form-control" name="email" value="{{ flashMessages.get('email', '') }}" placeholder="hello@example.com"> To avoid this, you have to write like this: <input type="email" class="form-control" name="email" value="{{ flashMessages.has('email') ? flashMessages.get('email') : '' }}" placeholder=" hello@example.com"> It is very uncomfortable. Is there any other way to get the old values? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey. Instead of writing
You can write
|
Beta Was this translation helpful? Give feedback.
Hey.
Instead of writing
You can write