无法在Bootstrap 4中进行验证

用户1675891:

我正在尝试通过Bootstrap进行验证,并将以下示例粘贴到了我的页面上:

<div class="form-group has-success">
  <label class="form-control-label" for="inputSuccess1">Input with success</label>
  <input type="text" class="form-control form-control-success" id="inputSuccess1">
  <div class="form-control-feedback">Success! You've done it.</div>
  <small class="form-text text-muted">Example help text that remains unchanged.</small>
</div>

我可以看到输入控件的外观发生了变化(现在有点圆了,现在更加美观了),但是它仍然没有显示绿色边框,就像在链接到的页面上可以看到的那样。我要链接到的Bootstrap指出如下。

<link rel="stylesheet"
      href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" />

我曾尝试用Google搜索此问题,但无济于事。在摆弄这个问题

我该怎么办?我想念什么?

吉姆:

Bootstrap 4 beta版本开始,验证已更改

有效状态选择器使用was-validated通过客户端 JavaScript 验证表单后将动态添加例如...

<form class="container was-validated" novalidate="">
    <div class="form-group">
        <label class="form-control-label" for="inputSuccess1">Input with success</label>
        <input type="text" class="form-control" name="i1" id="inputSuccess1">
        <div class="valid-feedback">Success! You've done it.</div>
    </div>
    <div class="form-group">
        <label class="form-control-label" for="inputSuccess2">Input with danger</label>
        <input type="text" class="form-control" name="i2" required="" id="inputSuccess2">
        <div class="invalid-feedback">That didn't work.</div>
    </div>
    <div class="">
        <button type="submit" class="btn btn-secondary">Text</button>
    </div>
</form>

https://www.codeply.com/go/45rU7UOhFo

更新2019-Bootstrap 4.0.0
表单验证示例演示


如文档中所述,如果您打算使用服务器端验证,则只需在表单控件上设置is-validis-invalid即可

<form class="container">
    <div class="form-group">
        <label class="form-control-label" for="inputSuccess1">Input with success</label>
        <input type="text" class="form-control is-valid" id="inputSuccess1">
        <div class="valid-feedback">Success! You've done it.</div>
    </div>
</form>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

f。在Rails中不应用Bootstrap中进行选择

为什么SmtpClient无法在我的Powershell脚本中进行身份验证?

Angular 4应用程序无法在Microsoft Edge和ie11中进行首次加载

无法为无法在数据库中进行身份验证的用户提供参数PASSWORD

无法在Angular 6中添加Bootstrap 4

Jetty + Jersey在intelliJ中工作无法在Jar中进行

.m4v格式的视频在根目录中时,无法在我的网络中进行星标下载

在Bootstrap 4中无法获取圆形按钮

无法在Angular 9中进行默认导入

无法从Python fdb中以“ @”开头的表中进行选择

无法启动Bootstrap-Vue表单验证

为什么在VS2012中创建的项目无法在Blend4 + SketchFlow中进行编辑

始终无法在Yii中进行验证

无法在代理背后的Ubuntu One中进行身份验证

无法在Ubuntu 14.04中进行Skype视频通话?

XML无法在带有外部DTD的Eclipse中进行验证

无法在自定义Laravel测试环境中进行身份验证(代码接收)

无法在JS中进行表单验证

如何在bootstrap3中进行此布局?

Xamarin无法在Visual Studio 2015中进行编译

对于Rails 4中的相关模型,验证无法按预期进行?

在Ruby on Rails 4中使用ActiveModel进行验证似乎无法正常工作

在Struts2中进行xml验证后无法重新填充值

无法从 BootStrap 3 更新到 BootStrap 4

表格内联无法在 Bootstrap 4 中打印?

无法加载 Carousel - Bootstrap 4

React Bootstrap 无法验证表单

错误:IndexError:无法从 Locust 中的空序列中进行选择

Google oauth + django - 无法从保存的数据中进行身份验证