文本区域和 Null,Laravel 集体
Text Area and Null, Laravel Collective
我一直在为我的表单使用 Laravel Collective,但我似乎遇到了文本区域问题。一个不允许我使用用于文本字段的相同代码更新空文本区域字段的方法。我认为问题出在 'null' 上,因为如果文本区域加载了文本,它允许我更改字段。有谁知道如何解决这个问题,以便我可以使用文本区域更改空字段?
{!! Form::label ('otherinfo', 'Other information:') !!}
{!! Form::textarea ('otherinfo', null, array('class' => 'form-control', 'required' => '', 'maxlength' =>'1500') ) !!}
您的示例应该可以正常工作。确保更新控制器以接受并保存 $request->input('otherinfo')
.
中存在的值
<?php
$otherinfo = 'Hello World';
?>
<div class="form-group">
{!! Form::label('otherinfo', 'Other information:') !!}
{!! Form::textarea('otherinfo', $otherinfo, ['class' => 'form-control', 'size' => '50x3']) !!}
</div>
我一直在为我的表单使用 Laravel Collective,但我似乎遇到了文本区域问题。一个不允许我使用用于文本字段的相同代码更新空文本区域字段的方法。我认为问题出在 'null' 上,因为如果文本区域加载了文本,它允许我更改字段。有谁知道如何解决这个问题,以便我可以使用文本区域更改空字段?
{!! Form::label ('otherinfo', 'Other information:') !!}
{!! Form::textarea ('otherinfo', null, array('class' => 'form-control', 'required' => '', 'maxlength' =>'1500') ) !!}
您的示例应该可以正常工作。确保更新控制器以接受并保存 $request->input('otherinfo')
.
<?php
$otherinfo = 'Hello World';
?>
<div class="form-group">
{!! Form::label('otherinfo', 'Other information:') !!}
{!! Form::textarea('otherinfo', $otherinfo, ['class' => 'form-control', 'size' => '50x3']) !!}
</div>