如何使用Android和将数据传递到另一种形式的创造钛登记表? [英] How to create registration form in Titanium using android and pass data to another form?

查看:163
本文介绍了如何使用Android和将数据传递到另一种形式的创造钛登记表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请给我的想法如何在钛创建登记表,并通过从形式到另一种形式填补注册数据。

Please give me idea how to create a registration form in titanium and pass fill up the registration data from that form to another form .

推荐答案

下面是一个示例code登记。我已经创建了资源文件夹中的其他文件success.js,显示了第二个窗口。请尝试以下code

Following is a sample code for registration. I have created an additional file 'success.js' in the resource folder, shows the second window. Please try the following code

写这些线路中的app.js文件

Write these line in the app.js file

var win1 = Ti.UI.createWindow({
 width : 'auto',
 height: 'auto',
 backgroundColor : '#FFFFFF'
});

var txtName = Ti.UI.createTextField({
 top   : '25%',
 width : '75%',
 height: '35',
 hintText : 'Name'
});

win1.add(txtName);

var txtAddress = Ti.UI.createTextField({
 top   : '35%',
 width : '75%',
 height: '40',
 hintText : 'Address'
});

win1.add(txtAddress);


var btnRegister = Ti.UI.createButton({
 top : '55%',
 width : '50%',
 height : '35',
 title  : 'Register'
});

 win1.add(btnRegister);

 win1.open();
 btnRegister.addEventListener('click', function(){

 var win2 = Ti.UI.createWindow({
  width : 'auto',
  height: 'auto',
  backgroundColor : '#FFFFFF',
  url  : 'success.js'
});

 win2.name = txtName.value;
 win2.address = txtAddress.value; 
 win2.open();
});

//写在success.js文件中的以下行

// Write the following lines in the success.js file

var win2 = Ti.UI.currentWindow;

var name = win2.name;
var address = win2.address;
var lblName = Ti.UI.createLabel({
  top  : '30%',
  width : '75%',
  height : 'auto',
  color  : 'yellow',
  backgroundColor : 'blue',
  text : name,
  textAlign : 'center'
 });

var lblAddress = Ti.UI.createLabel({
  top  : '40%',
  width : '75%',
  height : 'auto',
  color  : 'yellow',
  backgroundColor : 'blue',
  text : address,
  textAlign : 'center'
 });

 win2.add(lblName);
 win2.add(lblAddress);

现在complile的code和运行。它的工作和我在一起。试试吧

now complile the code and run. It worked with me. Try it

这篇关于如何使用Android和将数据传递到另一种形式的创造钛登记表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆