bootstrap 4表单错误未显示

时间:2017-11-16 21:27:58

标签: twitter-bootstrap

我有一个bootstrap 4表单已通过服务器上的验证(并生成错误)但是错误没有显示(但红色错误边框显示正确),即使我可以看到看起来像有效的HTML 。

使用bootstrap 4 beta 2:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css"
          integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">

(嗯,有趣的是,错误似乎与bootstrap alpha 6一样出现,但没有beta或beta 2)

<form action="" method="post" enctype="multipart/form-data">


<input type="hidden" name="csrfmiddlewaretoken" value="Xk3IX21aiZYwVaVXvM2dMLWfmhpb6idpeGvIH5RnfCPe2RRifuFA0ntUJRxC3Z7h"> <div id="div_id_postcode" class="form-group has-danger"> <label for="id_postcode" class="form-control-label sr-only requiredField">
                Please enter your postcode<span class="asteriskField">*</span> </label> <div class=""> <div class="input-group"> <span class="input-group-addon"><i class="fa fa-home"></i></span> <input type="text" name="postcode" value="asdfasdf" placeholder="Postcode" autofocus="" class="textinput textInput form-control is-invalid" required="" id="id_postcode"> </div> <span id="error_1_id_postcode" class="invalid-feedback"><strong>Please enter a valid postcode</strong></span> </div> </div>

<input id="signup-submit" class="btn btn-block btn-cta-primary" type="submit" value="Submit">
</form>

enter image description here

1 个答案:

答案 0 :(得分:0)

它是一个bs4 beta bug(在alpha 6中运行良好)。

可以在这里跟踪错误。

https://github.com/twbs/bootstrap/issues/23454