views:

195

answers:

1

Hi, I try to use first time the Dojo toolkit and I'm facing an error.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<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

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.

What's wrong?

A: 
<script type="text/javascript">
//<![CDATA[
    dojo.require("dojo.parser");
    dojo.addOnLoad(function(){
        dojo.parser.parse();
    });

// ]]>
</script>

This code solved the problem.

Roland Soós