Guest User

Untitled

a guest
May 13th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. dojo.provide("website.forms.RegistrationForm");
  2. dojo.require("dijit._Widget");
  3. dojo.require("dijit._Templated");
  4. dojo.require("dijit.form.Form");
  5. dojo.require("dijit.form.ValidationTextBox");
  6.  
  7. dojo.declare("website.forms.RegistrationForm", [dijit.form.Form],
  8. {
  9. isContainer: true,
  10. widgetsInTemplate: true,
  11. 'class': 'tundra',
  12. store: null,
  13. value: '',
  14. pageSize: 10,
  15. searchAttr: 'registration',
  16. autoComplete: false,
  17. 'name': 'registrationForm',
  18. id_counter: 0,
  19. preValues: [],
  20.  
  21. username: null,
  22. password: null,
  23. password_retype: null,
  24.  
  25. postCreate: function()
  26. {
  27. this.inherited(arguments);
  28. username = new dijit.form.ValidationTextBox( {
  29. type: "text",
  30. name: "username",
  31. value: "",
  32. trim: true,
  33. invalidMessage: "Please type a valid username",
  34. promptMessage: "Please type a valid username",
  35. regExp: "^[_a-zA-Z0-9-]+$",
  36. constraints: {'min': 4, 'max': 16},
  37. required: true,
  38. intermediateChanges: false,
  39. validator: this.checkLength
  40. }
  41. ).placeAt(this.domNode);
  42.  
  43. password = new dijit.form.ValidationTextBox(
  44. {
  45. type: "password",
  46. name: "password1",
  47. value: "",
  48. trim: true,
  49. invalidMessage: "Please type a valid password",
  50. regExp: "^[_a-zA-Z0-9-]+$",
  51. constraints: {'min': 4, 'max': 16},
  52. required: true,
  53. intermediateChanges: false,
  54. validator: this.checkLength
  55. }
  56. ).placeAt(this.domNode);
  57. password_retype = new dijit.form.ValidationTextBox(
  58. {
  59. type: "password",
  60. name: "password2",
  61. value: "",
  62. trim: true,
  63. invalidMessage: "Please re-type your password correctly",
  64. regExp: "^[_a-zA-Z0-9-]+$",
  65. constraints: {},
  66. required: true,
  67. intermediateChanges: false,
  68. validator: this.checkPassword
  69. }
  70. ).placeAt(this.domNode);
  71. },
  72. checkPassword: function(value, constraints)
  73. {
  74. return value == password.attr('value');
  75. },
  76. checkLength: function(value, constraints)
  77. {
  78. return value.length >= constraints.min && value.length <= constraints.max;
  79. }
  80. });
Add Comment
Please, Sign In to add comment