lundi 4 septembre 2017

Laravel Resubmit from Validation still show old input value

After validation when i resubmit form again data send to database but the old form is not clear in Laravel.

i use this for validation:

$this->validate($request, [
            'branch' => 'required|not_in:---Select Branch---',
            'dep' => 'required|not_in:--- Select Department ---',

            'txt_username' => 'required|min:5|max:20',            
        ]);

After insert to DB i redirect to route:

return redirect()->route('newrec');

When validation i use this code to remember old data that i just input with:

value=""

if i complete form it's will redirect to route newrec by clear all old data. But if i don't complete form validation it's will show old text i just input if i complete form validation and then resubmit and redirect to newrec route it's still show old value that i just input but data already add to DB. How can i clear it after resubmit the form.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire