开发者

Dojo form displays different in IE 8

For some reason, my code displays correctly in all browsers except 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>

I also get this error in IE8. "Could not load class 'dijit.form'. Did you spell the name correctly and use a full path, like 'dijit.form.button'? dojo.js


By removing the dojoType attribute from your form element, you've reverted to the generic HTML form. If you want to make use of Dojo Form validation, you can do so with something like this...

You'll need to use: 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>

Cheers.


I removed dojoType="dijit.form" from the form tag and it works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜