Skip to main content

Posts

Showing posts with the label dijit

Password Checking with Dojo

If you're puzzling over how to create the usual password and confirmation fields using Dojo,  try out this approach that I came up with for a project I'm working on: var passwordCheck = new ValidationTextBox({ id: "password-check", placeholder: "Password again...", type: "password", intermediateChanges: true, invalidMessage: "The value you have entered does not match the password you have chosen..." }); this.password = new ValidationTextBox({ name: "password", id: "password", placeholder: "Password...", type: "password", intermediateChanges: true, onChange: function () { passwordCheck.set("pattern", this.value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")); if(passwordCheck.value) { passwordCheck.validate(); } } }); It's really simple and keeps everything lean, relying on as little implementation code as possible.  Simply put, every time the pa...