onEvent("button1", "click", function( ) {
createRecord("messages", {fromUsername:(getText("text_input4")),Message:(getText("text_input1"))}, function(record) {
setText("text_input1", "");
});
});
onEvent("button2", "click", function( ) {
setText("text_area1", "");
readRecords("messages", {}, function(records) {
for (var i =0; i < records.length; i++) {
setText("text_area1", "From: "+ ((records[i].fromUsername + (" " + ("Message: " + records[i].Message)))));
}
});
});
onEvent("sign_up_1", "click", function( ) {
if (getText("username_input") == "") {
setText("Error", "Oops! Please enter a username!");
} else if ((getText ("password_input") == "")) {
setText("Error", "Oops! Please enter a password!");
} else {
var correctData={};
correctData.Password = getText("password_input");
correctData.Username = getText("username_input");
correctData.Account = getUserId();
createRecord("overall_info", correctData, function(record) {
console.log(record);
});
setScreen("new_user_welcome");
}
});
onEvent("sign_up2", "click", function( ) {
setScreen("sign_up_screen");
});
onEvent("sign_in_btn", "click", function( ) {
readRecords("overall_info", {Account:(getUserId())}, function(records) {
for (var q =0; q < records.length; q++) {
var x = (records[q]).Password;
}
if(x == getText("text_input6") ){
console.log("message");
setScreen("screen1");
}else
{
console.log("Incorrect password T-T");
}
});
});