Strange Error Dynamically Parsing form with Validator

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Strange Error Dynamically Parsing form with Validator

I have a strange situation where I am receiving a dojo.parse error from a dynamically loaded div.  My whole app is dynamically loaded divs, and so far, that has been working fine.  The parsing error only occurs if a validator is added to the data-dojo-props of a ValidationTextBox.  Even more confusing is, there is another dynamically loaded div with a ValidationTextBox and a validator that parses just fine.  Everything else about the page parses fine absent the validator property.

The particular error is:  

parser.js.uncompressed.js:899 dojo/parser::parse() error TypeError: Cannot read property 'get' of undefined(…)

I was thinking that it couldn't find the JavaScript function that makes up the validator, but that is loaded with the initial page, before all dynamic divs are loaded.

Here is the div that is the problem:

	<div class="field">
		<label for="newPassword" style="width: 100px">New Password:</label>
		<input id="newPassword" type="password" name="newPassword"
		    required data-dojo-type="dijit/form/ValidationTextBox"
		    data-dojo-props="placeHolder:'Enter your new password.',
		    				 missingMessage:'A password of at least six characters is required.',
		    				 invalidMessage:'Your password must be at least six characters in length',  
		    				 validator: validateReset" />		

Interestingly enough, this DIV parses just fine!

	<div class="field">
		<label for="confirmPassword" style="width: 100px">Confirm:</label>
		<input id="confirmPassword" type="password" name="confirmPassword"
		    required data-dojo-type="dijit/form/ValidationTextBox"
		    data-dojo-props="placeHolder:'Enter your password again.', 
		    				missingMessage: 'We cannot confirm if you do not re-enter your password',
		    				invalidMessage: 'Passwords do not match', 
		    				pattern:'.{6,}', validator: validatePassword" />