Click here to Skip to main content
15,902,198 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone. I'm making a form in laravel. one of the features I have is that you can select a customer from a pop-up box and it will put the customer's data in the textbox automatically. This works fine. The problem is when validation fails the old data is not put back in the textbox and you need to select your customer again.
<input type="text"  class="form-control" name="customerName" v-model="customerName"   value="{{old('customerName')}}">

Above you can see the code of my input. the input is bind to customerName. and because of this the old value cant be retrieved.
note that I'm using this in a normal blade view. and the vue code is stored in app.js.
Thx in advance for helping.

this is the controller with the validation
public function store(Request $request)
        $data = $this->ValidatedData();   
        //$customer = \App\Customer::find(request()->id);
        return redirect('/invoices');
    protected function ValidatedData()
        return request()->validate([
            'name' => 'required',
            'customerName' => 'required',
            'customerAdres' => 'required',
            'itemsjson' => 'required',
            'invoiceNumber' => 'required',

and this is the route i use
Route::post('/invoices', 'InvoiceController@store');

What I have tried:

Searched google for a solution. But i could not find anything that helped in my situation.
Updated 11-Mar-20 7:35am
Kris Lantz 11-Mar-20 13:23pm    
I think we'll need some additional code supplied. What does your validation look like, how is your form updated, etc, etc.
dolfijn3000 11-Mar-20 13:34pm    
I added the code in the question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900