Summernote 无法使用 laravel 表格
Summernote not working with laravel form
{!! Form::open(array('route' => 'posts.store', 'files' => true)) !!}
{{ Form::label('title', 'Title:') }}
{{ Form::text('title', null, array('class' => 'form-control'))}}
{{ Form::label('slug', 'Slug:') }}
{{ Form::text('slug', null, array('class' =>'form-control', 'required' =>
'', 'minlength' => '5', 'maxlength' => '255')) }}
{{ Form::label('category_id', 'Category:') }}
<select class="form-control" name="category_id">
@foreach($categories as $category)
<option value='{{ $category->id }}'>{{ $category->name }}
</option>
@endforeach
</select>
{{ Form::label('tags', 'Tags:') }}
<select class="form-control select2-multi" name="tags[]" multiple="multiple">
@foreach($tags as $tag)
<option value='{{ $tag->id }}'>{{ $tag->name }} </option>
@endforeach
</select>
{{ Form::label('body', 'Blog post:') }}
{{ Form::textarea('body', null, array('class' => 'form-control', 'id'=>'summernote', 'name'=>'editordata'))}}
{{ Form::submit('Create Post', array('class' => 'btn btn-success btn-lg btn-block', 'style' => 'margin-top: 20px'))}}
{!! Form::close() !!}
我有一个问题,当我向 textarea
写入内容或使用 summernote
添加图片并单击“创建”时 Post 我收到错误消息 'The body field is required' .我认为我的问题出在这一行:
{{ Form::label('body', 'Blog post:') }}
{{ Form::textarea('body', null, array('class' => 'form-control', 'id'=>'summernote', 'name'=>'editordata'))}}
有人对此有解决方案吗?
我认为问题出在你的数组上
{{ Form::textarea('body', null, array('class' => 'form-control', 'id'=>'summernote', 'name'=>'editordata'))}}
您明确覆盖了 html 文本区域的名称属性。删除名称 => .. 或使用以下内容:
{{ Form::textarea('body', null, array('class' => 'form-control', 'id'=>'summernote', 'name'=>'body'))}}
{!! Form::open(array('route' => 'posts.store', 'files' => true)) !!}
{{ Form::label('title', 'Title:') }}
{{ Form::text('title', null, array('class' => 'form-control'))}}
{{ Form::label('slug', 'Slug:') }}
{{ Form::text('slug', null, array('class' =>'form-control', 'required' =>
'', 'minlength' => '5', 'maxlength' => '255')) }}
{{ Form::label('category_id', 'Category:') }}
<select class="form-control" name="category_id">
@foreach($categories as $category)
<option value='{{ $category->id }}'>{{ $category->name }}
</option>
@endforeach
</select>
{{ Form::label('tags', 'Tags:') }}
<select class="form-control select2-multi" name="tags[]" multiple="multiple">
@foreach($tags as $tag)
<option value='{{ $tag->id }}'>{{ $tag->name }} </option>
@endforeach
</select>
{{ Form::label('body', 'Blog post:') }}
{{ Form::textarea('body', null, array('class' => 'form-control', 'id'=>'summernote', 'name'=>'editordata'))}}
{{ Form::submit('Create Post', array('class' => 'btn btn-success btn-lg btn-block', 'style' => 'margin-top: 20px'))}}
{!! Form::close() !!}
我有一个问题,当我向 textarea
写入内容或使用 summernote
添加图片并单击“创建”时 Post 我收到错误消息 'The body field is required' .我认为我的问题出在这一行:
{{ Form::label('body', 'Blog post:') }}
{{ Form::textarea('body', null, array('class' => 'form-control', 'id'=>'summernote', 'name'=>'editordata'))}}
有人对此有解决方案吗?
我认为问题出在你的数组上
{{ Form::textarea('body', null, array('class' => 'form-control', 'id'=>'summernote', 'name'=>'editordata'))}}
您明确覆盖了 html 文本区域的名称属性。删除名称 => .. 或使用以下内容:
{{ Form::textarea('body', null, array('class' => 'form-control', 'id'=>'summernote', 'name'=>'body'))}}