Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dojo.provide("website.forms.RegistrationForm");
- dojo.require("dijit._Widget");
- dojo.require("dijit._Templated");
- dojo.require("dijit.form.Form");
- dojo.require("dijit.form.ValidationTextBox");
- dojo.declare("website.forms.RegistrationForm", [dijit.form.Form],
- {
- isContainer: true,
- widgetsInTemplate: true,
- 'class': 'tundra',
- store: null,
- value: '',
- pageSize: 10,
- searchAttr: 'registration',
- autoComplete: false,
- 'name': 'registrationForm',
- id_counter: 0,
- preValues: [],
- username: null,
- password: null,
- password_retype: null,
- postCreate: function()
- {
- this.inherited(arguments);
- username = new dijit.form.ValidationTextBox( {
- type: "text",
- name: "username",
- value: "",
- trim: true,
- invalidMessage: "Please type a valid username",
- promptMessage: "Please type a valid username",
- regExp: "^[_a-zA-Z0-9-]+$",
- constraints: {'min': 4, 'max': 16},
- required: true,
- intermediateChanges: false,
- validator: this.checkLength
- }
- ).placeAt(this.domNode);
- password = new dijit.form.ValidationTextBox(
- {
- type: "password",
- name: "password1",
- value: "",
- trim: true,
- invalidMessage: "Please type a valid password",
- regExp: "^[_a-zA-Z0-9-]+$",
- constraints: {'min': 4, 'max': 16},
- required: true,
- intermediateChanges: false,
- validator: this.checkLength
- }
- ).placeAt(this.domNode);
- password_retype = new dijit.form.ValidationTextBox(
- {
- type: "password",
- name: "password2",
- value: "",
- trim: true,
- invalidMessage: "Please re-type your password correctly",
- regExp: "^[_a-zA-Z0-9-]+$",
- constraints: {},
- required: true,
- intermediateChanges: false,
- validator: this.checkPassword
- }
- ).placeAt(this.domNode);
- },
- checkPassword: function(value, constraints)
- {
- return value == password.attr('value');
- },
- checkLength: function(value, constraints)
- {
- return value.length >= constraints.min && value.length <= constraints.max;
- }
- });
Add Comment
Please, Sign In to add comment