简体   繁体   English

引导程序表单组

[英]Bootstrap form-group

I got two inputs inside a form-group, from bootstrap framework. 我从引导框架中获得了一个表单组内的两个输入。 My problem is if the first name gives error, the second name will give aswell the same error that gives on first name, and that is not what I want, how can I can avoid this problem? 我的问题是,如果名字给错误,第二个名字也会给与名字相同的错误,那不是我想要的,我该如何避免这个问题?

<form id="containerForm" class="form-horizontal">
    <div class="form-group">
        <label class="col-xs-3 control-label">First name</label>
        <div class="col-xs-4">
            <input required type="text" class="form-control" name="firstName" placeholder="First name" />
        </div>
        <label class="col-xs-3 control-label">Last name</label>

        <div class="col-xs-4">
            <input required type="text" class="form-control" name="lastName" placeholder="Last name" />
        </div>
    </div>
</form>

This is not a complete answer but there are more post on Stackoverflow.com about this item. 这不是一个完整的答案,但是Stackoverflow.com上有更多关于此项目的文章。

Anyway as I always do I advise you to use server-side validation 无论如何,我还是建议您使用服务器端验证

But just to get you going see this example:

http://jsfiddle.net/z2zbgge3/1/ http://jsfiddle.net/z2zbgge3/1/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM