Skip to content

Instantly share code, notes, and snippets.

@ericclemmons
Created September 9, 2009 05:19
Show Gist options
  • Save ericclemmons/183487 to your computer and use it in GitHub Desktop.
Save ericclemmons/183487 to your computer and use it in GitHub Desktop.
Example of demo.ui.Error
<!-- Dojo Config -->
<script type="text/javascript">
// Since we're using CDN resources, we have to define any local
// module paths first
var djConfig = {
// parseOnLoad: true, // Look for dojo events/hooks
// isDebug: true, // Enable debugging
baseUrl: "/static/js/", // Base path for all modules
modulePaths: {
demo: "demo" // Path to "demo" namespace
}
};
</script>
<!-- Dojo Cross-Domain CDN (Dijits too!) -->
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.3/dojo/dojo.xd.js" type="text/javascript" charset="utf-8"></script>
<!-- Include demo.ui.Error widget -->
<link rel="stylesheet" href="/static/js/demo/ui/resources/Error.css" type="text/css" media="screen" charset="utf-8">
<script type="text/javascript" charset="utf-8">
dojo.require("demo.ui.Error");
dojo.addOnLoad(function() {
dojo.query('.demo form').connect('onsubmit', function(event) {
event.preventDefault();
new demo.ui.Error({
message: 'Please try your login again'
});
}).query('button').attr('innerHTML', 'Login')[0].removeAttribute('disabled');
});
</script>
<form>
<p>
<em>Upon page load, this form no longer submits but displays a notification instead.</em>
</p>
<label>
Username:
<input type="text" name="username" value="uxdriven" />
</label>
<label>
Password:
<input type="password" name="password" value="password" />
</label>
<button type="submit" disabled="disabled">Waiting on Resources...</button>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment