Skip to content

Instantly share code, notes, and snippets.

@nathan5x-zz
Created April 12, 2018 06:45
Show Gist options
  • Save nathan5x-zz/655804d9d06586f1f6c30741826b3ad1 to your computer and use it in GitHub Desktop.
Save nathan5x-zz/655804d9d06586f1f6c30741826b3ad1 to your computer and use it in GitHub Desktop.
Create UI Component in HTML, CSS, and JS like it is in Adobe Flex & ActionScript
LoginControl.prototype = {
loginInitialize: function(placeHolder, name) {
var currentInstance = this;
var view = currentInstance.loginUI;
currentInstance.name = name;
view.children('.login-form').submit(function(event) {
if(currentInstance.loginData.username === '' || currentInstance.loginData.password === '') {
alert (currentInstance.name + ': Input fields should not be empty');
} else {
LoginAdapter.login(currentInstance);
}
event.preventDefault();
});
view.find('input[name=username]').change( function() {
currentInstance.loginData.username = $(this).val();
});
view.find('input[name=password]').change( function() {
currentInstance.loginData.password = $(this).val();
});
placeHolder.append(view);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment