Guest User

Untitled

a guest
Apr 20th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. LoginControl.prototype = {
  2. loginInitialize: function(placeHolder, name) {
  3. var currentInstance = this;
  4. var view = currentInstance.loginUI;
  5. currentInstance.name = name;
  6. view.children('.login-form').submit(function(event) {
  7. if(currentInstance.loginData.username === '' || currentInstance.loginData.password === '') {
  8. alert (currentInstance.name + ': Input fields should not be empty');
  9. } else {
  10. LoginAdapter.login(currentInstance);
  11. }
  12. event.preventDefault();
  13. });
  14.  
  15. view.find('input[name=username]').change( function() {
  16. currentInstance.loginData.username = $(this).val();
  17. });
  18.  
  19. view.find('input[name=password]').change( function() {
  20. currentInstance.loginData.password = $(this).val();
  21. });
  22.  
  23. placeHolder.append(view);
  24. }
  25. };
Add Comment
Please, Sign In to add comment