[英]Dojo dijit.form.ValidationTextBox help
I try to use first time the Dojo toolkit and I'm facing an error. 我第一次尝试使用Dojo工具包,但是遇到错误。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="/lib/dojo/dojo.js.uncompressed.js"></script>
<title>Insert title here</title>
</head>
<body>
<form enctype="application/x-www-form-urlencoded" action="" method="post">
<dl class="zend_form">
<dt id="teszt-label">
<label for="teszt" class="required">teszt:
</label>
</dt>
<dd id="teszt-element">
<input type="text" name="teszt" id="teszt" value=""
dojoType="dijit.form.ValidationTextBox"
regExp="\d{5}" required="true" invalidMessage="asd" />
</dd>
</dl>
</form>
<script type="text/javascript">// <![CDATA[
dojo.require("dijit.form.ValidationTextBox");
// ]]></script>
</body>
</html>
I got the script from the second example: http://www.dojotoolkit.org/reference-guide/dijit/form/ValidationTextbox.html#dijit-form-validationtextbox 我从第二个示例获得了脚本: http : //www.dojotoolkit.org/reference-guide/dijit/form/ValidationTextbox.html#dijit-form-validationtextbox
The script must validate the input with the given regular expression. 该脚本必须使用给定的正则表达式验证输入。 I see in firebug, that it loads all of the required components, but it doesn't work on the input field. 我在Firebug中看到,它加载了所有必需的组件,但是在输入字段上不起作用。
What's wrong? 怎么了?
regExp="\\d{5}"
到regExp: "[\\\\d]{5}"
<script type="text/javascript">
//<![CDATA[
dojo.require("dojo.parser");
dojo.addOnLoad(function(){
dojo.parser.parse();
});
// ]]>
</script>
This code solved the problem. 这段代码解决了这个问题。
how about doing this instead? 怎么做呢?
<script type="text/javascript" src="/assets/dojo/dojo.js" data-dojo-config="parseOnLoad: true, isDebug: true"></script>
isDebug: true
is set if you want some debug messages appearing on browser's console. isDebug: true
如果要在浏览器的控制台上显示一些调试消息,则设置isDebug: true
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.