【发布时间】:2025-11-22 11:05:02
【问题描述】:
我的 XPage 中有以下代码,但是它不适用于给定字段 ipAddress,即使它是空白的,它也不会提示任何验证,我也尝试使用 #{id:ipAddress},它不起作用.我正在使用 Notes 9 和 Designer 9。任何人都可以帮助我使用 bootstrapValidator 功能在 XPages 中进行字段验证的其他方式。
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" id="testid">
<xp:this.resources>
<xp:styleSheet href="/bootstrap.css"></xp:styleSheet>
<xp:styleSheet href="/bootstrapValidator.min.css"></xp:styleSheet>
<xp:script src="/jquery-1.11.1.js" clientSide="true"></xp:script>
<xp:script src="/bootstrap.min.js" clientSide="true"></xp:script>
<xp:script src="/bootstrapValidator.js" clientSide="true"></xp:script>
<xp:script src="/jquery.mask.min.js" clientSide="true"></xp:script>
</xp:this.resources>
<xp:form id="maskForm">
<div class="col-lg-5">
<xp:inputText id="ipAddress" title="ipAddress">
</xp:inputText>
</div>
</xp:form>
<xp:scriptBlock>
<xp:this.value><![CDATA
var test ="view:_id1";
var fieldvalue="#view:_id1:_id4:_id142:_id143:callback1:idLocation";
XSP.addOnLoad( function() {
$("#"+test).bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
fieldvalue: {
message: 'The username is not valid',
validators: {
notEmpty: {
message: 'The username is required and can\'t be empty'
},
stringLength: {
min: 6,
max: 30,
message: 'The username must be more than 6 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_\.]+$/,
message: 'The username can only consist of alphabetical, number, dot and underscore'
}
}
} } }) });
]]></xp:this.value>
</xp:scriptBlock>
</xp:view>
<!-- end snippet -->
这里附上图片,根据你的建议输出 image of error
【问题讨论】:
标签: twitter-bootstrap xpages bootstrapvalidator