我正在使用nghuuphuoc的0.5.2版本的BootstrapValidator,我想验证用户是否选择了另一个元素而不是第一个元素。
这是下拉列表html:
<select class="form-control valid" id="DocumentType" name="DocumentType">
<option value="0">Select</option>
<option value="1">DNI</option>
<option value="2">CI</option>
<option value="3">CUIT</option>
<option value="4">PASAPORTE</option>
</select>
当用户没有选择一个选项(不同于&#34; Select&#34;或者与value = 0不同)时,我们的想法是应用引导错误类
使用BootstrapValidator有没有办法实现这个目的?类似的东西:
$('#msform').bootstrapValidator({
// To use feedback icons, ensure that you use Bootstrap v3.1.0 or later
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
DocumentType: {
validators: {
<validation that check if 1st elemet is selected>: {
field: 'DocumentType',
message: 'Select an option ',
},
}
},
}
});
答案 0 :(得分:1)
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
android:id="@+id/constraintLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/red"
tools:context="frekzok.trafficlight.MainActivity">
</android.support.constraint.ConstraintLayout>