带有引导程序的 LARAVEL 样式的密码字段

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22116102/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 09:07:00  来源:igfitidea点击:

LARAVEL styled password field with bootstrap

htmlcsstwitter-bootstraplaravellaravel-4

提问by DolDurma

in this form i heve Form::password()and i can not styled or embeded class for that. for example this below class and style for Form::textcan work correctly.

在这种形式中Form::password(),我无法设计或嵌入类。例如下面的类和样式Form::text可以正常工作。

{{ Form::text('username', Input::old('username'), array('placeholder'=>'UserName', 'class'=>'form-control' ) ) }}

Generated HTML:

生成的 HTML:

<input id="username" class="form-control" type="text" name="username" placeholder="username">

but for Form::password()do not work:

但对于Form::password()不工作:

{{ Form::password('password', null, array('placeholder'=>'Password', 'class'=>'form-control' ) ) }}

Generated HTML:

生成的 HTML:

<input id="password" type="password" value="" name="password">

回答by Jozef

This will work:

这将起作用:

{{ Form::password('password', array('placeholder'=>'Password', 'class'=>'form-control' ) ) }}

You don't need the null as you cannot specify a default value for password fields.

您不需要 null,因为您无法为密码字段指定默认值。

回答by theUtherSide

You can also use a custom HTML macro that enables the syntax similar to your first example.

您还可以使用自定义 HTML 宏来启用与您的第一个示例类似的语法。

See my answer here: How to pass value to Password field in Laravel

在此处查看我的答案: 如何将值传递给 Laravel 中的密码字段