ユーザーが最初に登録する必要がある sencha touch アプリを実行しようとしています。その後、ポップアップ アラートが表示され、ユーザーが「OK」ボタンを押すと、登録フォーム (register.js) がログイン フォーム (login.js) に移動します。
これは私のregister.jsです:
Ext.define('demo.view.Register',{
extend:'Ext.form.Panel',
xtype:'register',
requires:[
'Ext.form.FieldSet',
'Ext.field.Email',
'demo.view.Login'
],
config:{
title:'Register',
iconCls:'user',
url:'doRegister.php',
items:[
{
xtype:'fieldset',
title:'Registration!!!',
items:[
{
xtype:'textfield',
name:'username',
label:'Name'
},
{
xtype:'passwordfield',
name:'password',
label:'Password'
},
{
xtype:'emailfield',
name:'email',
label:'Email'
},
{
xtype:'textfield',
name:'first_name',
label:'First Name'
},
{
xtype:'textfield',
name:'last_name',
label:'Last Name'
}
]
},
{
xtype:'button',
text:'Share',
ui:'confirm',
handler: function() {
// This looks up the items stack above, getting a reference to the first form it see
var form = this.up('register');
// Sends an AJAX request with the form data to the url specified above (contact.php).
// The success callback is called if we get a non-error response from the server
form.submit({
success: function() {
Ext.Msg.alert('Status', 'Resgistered Successful!', function(btn, text){
if (btn == 'ok'){
var redirect = 'login.js';
window.location = redirect;
}
});
}
});
}
}
]
}
});
これは私の login.js です:
Ext.define('demo.view.Login',{
extend:'Ext.form.Panel',
xtype:'login',
requires:[
'Ext.form.FieldSet',
'Ext.field.Email'
],
config:{
title:'Login',
iconCls:'user',
url:'doLogin.php',
items:[
{
xtype:'fieldset',
title:'Please Login',
items:[
{
xtype:'textfield',
name:'username',
label:'username'
},
{
xtype:'passwordfield',
name:'password',
label:'password'
}
]
},
{
xtype:'button',
text:'Login',
ui:'confirm',
handler: function() {
// This looks up the items stack above, getting a reference to the first form it see
var form = this.up('share');
// Sends an AJAX request with the form data to the url specified above (contact.php).
// The success callback is called if we get a non-error response from the server
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 = 'Share.js';
window.location = redirect;
}
});
}
});
}
}
]
}
});