Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Application.Login = Ext.extend(Ext.Container, {
- constructor: function(config) {
- var username = new Ext.form.TextField();
- var password = new Ext.form.TextField();
- var loginButton = new Ext.Button({
- text : "Login",
- listeners : {
- click : function () {
- Ext.Ajax.request({
- url: 'service/login',
- jsonData : { "username" : username.getValue(), "password" : password.getValue() },
- success:function(response, options) {
- jsonObj = Ext.util.JSON.decode(response.responseText);
- if (jsonObj.success) {
- Ext.Msg.alert('Status', 'Login Successful!');
- } else {
- Ext.Msg.alert('Login Failed!', jsonObj.errors.reason);
- }
- },
- failure:function(response, options) {
- Ext.Msg.alert('Server error');
- }
- })
- }
- }
- });
- config = Ext.apply({
- layout: "column",
- items:[
- {
- columnWidth: .5
- },
- {
- items : username,
- columnWidth : .2
- },
- {
- items : password,
- columnWidth : .2
- },
- {
- items : loginButton,
- columnWidth : .1,
- layout : 'fit'
- }
- ]
- }, config);
- Application.Login.superclass.constructor.call(this, config);
- }
- });
Add Comment
Please, Sign In to add comment