出于某种原因,我的代码在除IE8之外的所有浏览器中都能正确显示。
<form dojoType="dijit.form">'
<ul class="ul_two_col_form">
<li>
<label>Name</label>
<input dojoType="dijit.form.ValidationTextBox" invalidMessage="Name is required." required="true" propercase="true" trim="true" id="contactname" />
<div dojoType="dijit.Tooltip" connectId="contactname">
Please enter a name.
</div>
</li>
<li>
<label>Email</label>
<input dojoType="dijit.form.ValidationTextBox" invalidMessage="Email is required." regExp="[a-z0-9._%+-]+@[a-z0-9-]+\.[a-z]{2,4}" required="true" trim="true" id="contactemail" />
<div dojoType="dijit.Tooltip" connectId="contactemail">
Please enter your email address.
</div>
</li>
<li>
<label>Message</label>
<textarea dojoType="dijit.form.Textarea" id="contactmessage" rows="6"></textarea>
<div dojoType="dijit.Tooltip" connectId="contactmessage">
Please enter a message.
</div>
</li>
<li>
<button dojoType="dijit.form.Button" type="button" onclick="essentials.SendContactUsEmail();">Send your request</button>
</li>
</ul>
</form>
我在IE8中也遇到了这个错误。 “无法加载类'dijit.form'。你是否拼写了正确的名称并使用了完整的路径,比如'dijit.form.button'? 的dojo.js
答案 0 :(得分:1)
通过从form
元素中删除 dojoType 属性,您已恢复为通用HTML表单。如果你想使用 Dojo Form 验证,你可以用这样的东西来做...
您需要使用:dijit.form.Form
<head>
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("dojo.form.Form");
dojo.require("dojo.form.ValidationTextBox");
dojo.require("dojo.form.Button");
// more includes here...
</script>
</head>
<body>
<form dojoType="dijit.form.Form" action="..." method="...">
<input dojoType="dijit.form.ValidationTextBox" trim="true" regExp="..." invalidMessage="Oops...">
<!-- // more form elemts here... -->
<button type="submit" dojoType="dijit.form.Button" ...>
Submit
</button>
<script type="dojo/method" event="onSubmit">
if (!this.validate()) {
alert("Form contains invalid data. Please correct....");
return false;
}
return true;
<script>
</form>
</body>
干杯。
答案 1 :(得分:0)
我从表单标记中删除了 dojoType =“dijit.form”,但它确实有效。