我想知道如何(通过简单的工作示例)将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/

10-09 07:44