Any Sencha Touch developer here?? Need lots of help..like books to follow(I know there are only a few)..available online tutorial..I'm getting stuck at every step!!
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Sencha Touch Login</title>
<script src="lib/sencha-touch.js" type="text/javascript"></script>
<link href="lib/resources/css/sencha-touch.css" rel="stylesheet" type="text/css" />
<script src="login.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
Ext.setup({
onReady: function() {
var form;
var formBase = {
scroll: 'vertical',
url: 'login1.jsp',
standardSubmit: false,
items: [{
xtype: 'fieldset',
title: 'Personal Info',
instructions: 'Please fill in the details.',
defaults: {
required: true,
labelAlign: 'left',
labelWidth: '40%'
},
items: [
{
xtype: 'textfield',
name : 'username',
label: 'Username',
useClearIcon: true,
autoCapitalize : false
},
{
xtype: 'passwordfield',
name : 'password',
label: 'Password',
useClearIcon: true
}
]
}
],
dockedItems: [
{
xtype: 'toolbar',
dock: 'bottom',
items: [
{
text: 'Reset',
handler: function() {
form.reset();
}
},
{
text: 'Save',
ui: 'confirm',
handler:function(){
form.submit({
method:'POST',
waitTitle:'Connecting',
waitMsg:'Sending data...',
success:function(){
Ext.Msg.alert('Status', 'Login Successful!', function(btn, text){
if (btn == 'ok'){
/*var redirect = '*www.google.com';
window.location = redirect;*/
}
});
},
failure:function(form, action){
if(action.failureType == 'server'){
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('Login Failed!', obj.errors.reason);
}else{
Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText);
}
form.reset();
}
});
}
}
]
}
]
};
if (Ext.is.Phone) {
formBase.fullscreen = true;
} else {
Ext.apply(formBase, {
autoRender: true,
floating: true,
modal: true,
centered: true,
hideOnMaskTap: false,
height: 385,
width: 480
});
}
form = new Ext.form.FormPanel(formBase);
form.show();
}
});
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "*www.w3.org/TR/html4/loose.dtd">
<%
System.out.println("inside login.jsp");
String result;
String loginUsername = request.getParameter("username");
System.out.println("inside login.jsp1"+loginUsername);
if (null != loginUsername && loginUsername.length() > 0) {
System.out.println("inside login.jsp2"+loginUsername);
if (loginUsername.equals("f")){
result = "{success:true}";
System.out.println("inside login.jsp3"+loginUsername);
}else{
System.out.println("inside login.jsp4"+loginUsername);
result = "{success:false,errors:{reason:'Login failed.Try again'}}";
}} else {
System.out.println("inside login.jsp5"+loginUsername);
result = "{success:false,errors:{reason:'Login failed.Try again'}}";
}
System.out.println(result);
%>
<%=result %>
text: 'Save',
ui: 'confirm',
handler:function(){
form.submit({
method:'POST',
waitTitle:'Connecting',
waitMsg:'Sending data...',
success:function(){
Ext.Msg.alert('Status', 'Login Successful!', function(btn, text){
if (btn == 'ok'){
/*var redirect = '*www.google.com';
window.location = redirect;*/
}
});
},
Not sure, will get back to you in the morning.