gpt4 book ai didi

javascript - dijit ValidationTextBox 如何添加最小长度和最大长度

转载 作者:行者123 更新时间:2023-11-28 15:19:02 24 4
gpt4 key购买 nike

我想知道如何(通过简单的工作示例)将 maxlengthminlength 添加到由

生成的输入标记
dijit/form/ValidationTextBox

所需输出的示例:

<input maxlength="10" minlength="2" class="dijitReset dijitInputInner" data-dojo-attach-point="textbox,focusNode" autocomplete="off" name="title" type="text" tabindex="0" id="Image-1-title-LabelValidationTextBox" aria-required="undefined" value="Title text for image Image-1" aria-invalid="false">

最佳答案

使用正则表达式约束尝试此示例

<input type="text" value="someTestString" required="true"
data-dojo-type="dijit/form/ValidationTextBox"
data-dojo-props="regExp: '[a-zA-Z0-9$%!_]{2,10}', invalidMessage: 'The value must be at least 2 character and maximum 10'" />

关于javascript - dijit ValidationTextBox 如何添加最小长度和最大长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32326800/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com