Twitter bootstrap 引导程序中的错误类
如果在提交按钮后输入为空,我想显示错误验证。问题是错误总是以黑色显示。我希望它是红色的。我在应用程序中使用引导、刀片和LaravelTwitter bootstrap 引导程序中的错误类,twitter-bootstrap,laravel,twitter-bootstrap-3,blade,Twitter Bootstrap,Laravel,Twitter Bootstrap 3,Blade,如果在提交按钮后输入为空,我想显示错误验证。问题是错误总是以黑色显示。我希望它是红色的。我在应用程序中使用引导、刀片和Laravel {{ $errors->first('Namespace', '<span class="alert alert-error">:message</span>') }} {{ Form::label('Namespace', 'Namespace', array( 'class' => 'col-sm-2
{{ $errors->first('Namespace', '<span class="alert alert-error">:message</span>') }}
{{ Form::label('Namespace', 'Namespace', array( 'class' => 'col-sm-2 control-label')) }}
<div class="col-sm-2">
{{ Form::text('Namespace', Input::old('Namespace'), array( 'class' => 'form-control', 'id' => 'namespace')) }}
</div>
</div>
{{$errors->first('Namespace',':message')}
{{Form::label('Namespace','Namespace',array('class'=>'col-sm-2 control label'))}
{{Form::text('Namespace',Input::old('Namespace'),array('class'=>'Form control','id'=>'Namespace'))}
我需要你的帮助。
提前感谢。您需要使用(对于Bootstrap 3,我假设您使用它,因为您没有提到版本):
{{$errors->first('Namespace',':message')}
而不是:
{{ $errors->first('Namespace', '<span class="alert alert-error">:message</span>') }}
{{$errors->first('Namespace',':message')}
参考资料:如果他使用的是引导v3。也就是说,我看不出还有什么明显不正确的地方。除此之外,他可能只想确保他使用的是bootstrap的版本,他就是这个版本。@charles你说得对。OP没有提到Bootstrap版本(他在创建帖子时使用了错误的
Bootstrap
标记),但由于没有提到版本,我认为假设他使用v3是合理的,但我已经在我的答案中添加了信息,谢谢
{{ $errors->first('Namespace', '<span class="alert alert-error">:message</span>') }}