简体   繁体   中英

Column of text type returned but not displayed in laravel 5.4 edit form

Working on an edit form, i'm able to display all data from my query except the one for addresses. Looked up my code and it looks good but still the old data from database isn't showing in that field. Could this be the way am calling it since its of text type?

Controller

public function edit($id)
{
    $customer= Customer::findOrFail($id);

    dd($customer->contact_address);

    //return view('customers.edit', compact('customer'));
}

dd($customer->contact_address) returns

"18B Harvey Street, Crosstour Estate. Ikeja, Lagos."

edit form field

<div class="form-group">
    <label for="contact_address" class="col-md-4 control-label">Contact Address</label>
    <div class="col-md-6">
        <textarea id="contact_address" type="text" class="form-control" name="contact_address" value="{{ $customer->contact_address }}" row="3" required autofocus></textarea>
     </div>
 </div>

How do make it display like the other field are?

value is not a textarea attribute, output the address between the textarea tags:

<textarea>{{ $customer->contact_address }}</textarea>

Alternatively, I believe textarea elements support the placeholder attribute, so:

<textarea placeholder="{{ $customer->contact_address }}"></textarea>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM