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 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的