Reputation: 1545
I've got the following blade file. I'm passing in a project object with a title and description and I want to populate the value attributes. The description variable works inside the p-tag, but not in the textarea-tag. The $title variable works fine also. Why doesn't it work in the textarea?
@extends('layout')
@section('content')
<h1 class="display-4">Edit Project</h1>
<p>{{ $project->description }}</p>
<form>
<div class="form-group">
<label for="title">Title</label>
<input type="text" class="form-control" name="title" placeholder="Title" value="{{ $project->title }}">
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea type="text" class="form-control" name="description" value="{{ $project->description }}"></textarea>
</div>
<button type="submit" class="btn btn-primary">Update Project</button>
</form>
@endsection
Upvotes: 1
Views: 8255
Reputation: 934
It should be like
<textarea type="text" class="form-control" name="description" >{{ $project->description }}</textarea>
Upvotes: 1
Reputation: 4153
There is no value
attribute in textarea
tag. Instead, put the value between open and close tag:
<textarea type="text" class="form-control" name="description">{{ $project->description }}</textarea>
See this link for more information.
Upvotes: 7