简体   繁体   中英

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

 <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.

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

}

Added required in label class.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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