douguachi0056 2014-08-27 17:42
浏览 98

仅当字段包含值时,Bootstrap才会进行验证

Bootstrap validate only if field contain value

I would like to only use my bootstrap validator if

I got this code below that use bootstrap validator

<tr>
<td><b>1</b></td>
<td>
<select class="form-control" name="DaySelection1">
<option value="">Select</option>
<option value="wed">Wed</option>
<option value="thu">Thu</option>
<option value="fri">Friday</option>
</select>
</td>

<td class="form-group">
<input type="text" class="form-control" name="digits1"
                required
                min="000"
                data-bv-greaterthan-inclusive="true"
                data-bv-greaterthan-message="The input must be greater than or equal to 0"

                max="999"
                data-bv-lessthan-inclusive="false"
                data-bv-lessthan-message="The input must be less than or equal to 999" />
</td>
<td class="form-group"><input type="number" data-bv-digits-message="true" class="form-control" name="big1" id="name1" size="6"></td>
<td><input type="number" class="form-control" name="small1" size="6"></td>
</tr>

I would only like to run my validate on the row that the

select class by the name "DaySelection" value is not "" 

The name of each input is goes by e.g "digits$i", "big$i", "small$i"

where $i is a integer of

1 to 10

to identify each individual row of input type

How do I change my bootstrap code.

Because currently I got a for loop that print out the same field, those field that are not filled up also got this validation done, I only want to validate row that got DaySelection value

  • 写回答

1条回答 默认 最新

  • dongqian9567 2014-08-27 18:00
    关注

    I use

    data-bv-threshold="1" 
    

    to solve my issue.

    评论

报告相同问题?

悬赏问题

  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图