简体   繁体   English

label 附近的强制字段检查和星号符号弹出警告框 - JSP 表格 Spring mvc

[英]PopUp alert box for Mandatory field checking and Asterisk symbol near label - JSP Form Spring mvc

I need Asterisk symbol to indicate a required input near form control label and make popup alert for mandatory field if it is not filled up我需要星号来表示表单控件 label 附近的必需输入,如果未填写,则为必填字段弹出警报

 <div class="form-group form-group">
            <label for="status" class="col-sm-2 control-label">
                <spring:message code="labels.status"/>
            </label>

            <div class="col-sm-9">
                <input id="picture" class="form-control" type="text" value="${form.status}" name="status"
                       autofocus/>
                <form:errors path="status" style="color:red;"></form:errors>
            </div>
        </div>

Added below code in css file.在 css 文件中添加以下代码。

.required:after {
content:" *";
color: red;

} }

Added required in label class.在 label class 中添加要求。

<label for="status" class="col-sm-2 control-label required ">
            <spring:message code="labels.status"/>

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

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