XML Code is given below:
<Alloy> <Window class="container"> <View id="banner" layout="verticle">
<ImageView id="bannerimage" />
<Label id="logotext" textAlign="Center">Ekant Solution </Label>
</View>
//This is for user name ...
<Label id="label1" top="70" text="User Name" />
<TextField id="txtuid" top="100" width="250" height="30" borderColor="#0D00F2" />
// This is for password field...
<!-- <Label id="label2" top="150">Password</Label>
<TextField id="txtpwd" top="180" width="250" height="30" passwordMask="true" />
-->
// Submit Button creation...
<Button id="button" onClick="doClick" title="Submit" top="250" width="100" height="50" backgroundColor="#D1B899" size="33" left="50" />
// Reset button create here..
<Button id="button1" onClick="eraseme" title="Reset" top="250" width="100" height="50" backgroundColor="#B8CAA7" size="33" right="60" />
// Edit button creation...
<Button id="button2" onClick="edit"
title="Edit" top="350" width="150" height="50" backgroundcolor="#E0D6CC" size="33" bottom="5" color="#546154"
borderColor="#6342FF"></Button>
</Window>
</Alloy>
index.js code is given below...
function eraseme(){ var texuid; $.txtuid.value=""; alert("Reset Successfull...");
};
$.index.open();
function doClick(e){
if ($.txtuid.value=="" )
{
Titanium.API.info("You need to put a user id in");
$.txtuid.value="";
alert("Please fill the text");
}
};
function doClick(e){
if($.txtuid.value != "" && $.txtuid.value != null){
var request = Ti.Network.createHTTPClient({
onload:alert("Your chore has been submitted"),
onerror: function(e){
Ti.API.debug(e.error);
alert('There was an error during the conexion');
},
timeout:1000,
});
//Request the data from the web service, Here you have to change it for your local ip
request.open("POST","http://192.168.16.2/justbiz/user.php");
var params = ({"singh": $.txtuid.value,});
request.send(params);
}
else{
alert("Please write something in the textbox");
}
$.txtuid.value = "";
};
////////////clear
function edit()
{
if($.txtuid.value != "" && $.txtuid.value != null){
var request = Ti.Network.createHTTPClient({
onload:alert("Your chore has been submitted"),
onerror: function(e){
Ti.API.debug(e.error);
alert('There was an error during the conexion');
},
timeout:1000,
});
//Request the data from the web service, Here you have to change it for your local ip
request.open("GET","http://192.168.16.2/justbiz/fetchdata.php");
var params = ({"singh": $.txtuid.value,});
request.responseText(params);
}
else{
alert("Please write something in the textbox");
}
$.txtuid.value = "";
};
index.tss code is given below...
"#index": { backgroundColor: "#fff", }, "#banner":{ backgroundColor: "#072550", height:50, top:0 }, "#bannerimage": { image:'/state2.png', left:10 }, "#logotext":{ borderWidth:0, left: 55, color:'fff' }, "Label": { width: Ti.UI.SIZE, height: Ti.UI.SIZE, color: "#000", font: { fontSize: 20, fontFamily: 'Helvetica Neue' }, textAlign: 'center' } , "TextField":{ borderStyle:Ti.UI.INPUT_BORDERSTYLE_ROUNDED, color: '#336699' }, ".container":{
}