please help

Hi,
We have a working web app (using html, css & javascript) that only utilizes the local storage, thus can only accommodate one user at a time. We are tasked to improve it to allow multiple users accessing at a time and we’re advised to use backendless for this. We’ve been reading the documetation and watching the tutorials and other stuff for almost 2 weeks now and we only have one more week to finish this project so we’re really getting desperate. We also have a github repository for this project and a live website using github but we couldn’t use both. We’ve uploaded all our files to backendless but we’re having a hard time making it work. There are several interlinked pages and so far, we’ve only managed to do the sign up and sign in pages.
We’ve linked up the next page which supposedly ask the user some details then save it to a table relating to that person. We’re not yet experienced coders and we’re doing a crash course on programming and we find that some of the processes and terms used in the documentation and tutorials to be too daunting for us.
We tried to use the codes from the generator. We can make use of the file service (uploading files) but how can we save the file to the table instead of the TEST_TABLE folder?
We were told that we don’t need to change anything in our code except for the initialization but then we could not make it work as it is. Also, with the custom domain name, can it just be anything and how do we set up the CNAME?
Thanks and sorry for the bother.

Hi Felicia,

It’s not really clear what your request is, but I’ll try to break it down to questions and answer.

We tried to use the codes from the generator. We can make use of the file service (uploading files) but how can we save the file to the table instead of the TEST_TABLE folder?

In order to save something to a table you need to use Data Service API. Here’s a tutorial on how to do that: https://backendless.com/docs/android/doc.html#data_saving_data_objects (in case you’re not using Android, you can switch the SDK on the top of the page).

We were told that we don't need to change anything in our code except for the initialization but then we could not make it work as it is. Also, with the custom domain name, can it just be anything and how do we set up the CNAME?

And here is a tutorial on how to set up custom domain: https://backendless.com/feature-33-mapping-a-domain-name-to-your-backendless-file-storage/ (it’s for version 3, but the process is totally the same for v4).

If you have any further questions, please clarify.
Also I’m going to make your topic public since private topics are only for paid customers.

Thanks, Sergey… I didn’t realize the private topic is only for paid customers as I was able to click it… sorry about that.

With regards to the domain name, I see that there should be an existing website first before we could use the custom domain. Is it the same for the domain control option?

We’re having a hard time with saving even with the guide. This is our original javascript code for using the local storage:

      
var userDetails = {
	firstname: "",
	surname: "",
	birthday: "",
	nationality: "",
	mobilenumber: "",
};


function store() {
	var personFirstName = document.getElementById("firstname");
	// localStorage.setItem("firstname", personFirstName.value);


	var personSurname = document.getElementById("surname");
	// localStorage.setItem("surname", personSurname.value);


	var personBirthday = document.getElementById("birthday");
	// localStorage.setItem("birthday", personBirthday.value);


	var personNationality = document.getElementById("nationality");
	// localStorage.setItem("nationality", personNationality.value);


	var personMobileNum = document.getElementById("mobilenumber");
	// localStorage.setItem("mobilenumber", personMobileNum.value);


	userDetails['firstname'] = personFirstName.value;
	userDetails['surname'] = personSurname.value;
	userDetails['birthday'] = personBirthday.value;
	userDetails['nationality'] = personNationality.value;
	userDetails['mobilenumber'] = personMobileNum.value;


	var json = JSON.stringify(userDetails);
	localStorage.setItem("userDetails", json);
}


function getDetails() {
	var details = localStorage.getItem('userDetails');
	if(details != undefined) {
		details = JSON.parse(details);


		document.getElementById("firstname").value = details['firstname'];


		document.getElementById("surname").value = details['surname'];


		document.getElementById("birthday").value = details['birthday'];


		document.getElementById("nationality").value = details['nationality'];


		document.getElementById("mobilenumber").value = details['mobilenumber'];
	}
};


getDetails(); // Fetches the details if it exists


document.getElementById("form-details").addEventListener("submit", function(event) {
  store();
  event.preventDefault();
  window.location.replace("plantingpage.html");
  return false;
}, false);

Not sure how we could translate it to backendless saving. We tried using the guide and other question but we still couldn’t make it work. This is how we tried to do it:


function Person(args) {
    args = args || {};
    this.firstname = args.firstname || "";
    this.surname = args.surname || "";
    this.birthday = args.birthday || "";
    this.nationality = args.nationality || "";
    this.mobilenumber = args.mobilenumber || "";
}


var APP_ID = '51E0882E-66E1-C263-FFB3-3C5C4B11F200';
var API_KEY = '2B0290E2-D0EE-4979-FFB6-2A5467944300';


Backendless.serverURL = "https://api.backendless.com";
Backendless.initApp(APP_ID, API_KEY);


Backendless.Data.of( "Person" ).save( { firstname:"", surname:"", birthday:"", nationality:"", mobilenumber:"" } )
    .then( function( Person ) {
        console.log( "person saved. personObject " + Person.personObject )
    } )
    .catch( function( error ) {
        console.log( "got error - " + error )
    })


if (!APPLICATION_ID || !API_KEY)
    alert("Missing application ID or api key arguments. Login to Backendless Console, select your app and get the ID and key from the Manage > App Settings screen. Copy/paste the values into the Backendless.initApp call located in We_Plant-Login.js");
    


var Person = persistedDataObject["Person"];


var createdTime = persistedDataObject["created"];
var updatedTime = persistedDataObject["updated"];


function handleClick()
{
var firstname = document.getElementById("firstname").value,
surname = document.getElementById("surname").value,
birthday = document.getElementById("birthday").value,
nationality = document.getElementById("nationality").value,
mobilenumber = document.getElementById("mobilenumber").value;




var personObject = new Person( {
firstname: firstname,
surname: surname,
birthday: birthday,
nationality: nationality,
mobilenumber: mobilenumber,
});
var savedPerson = Backendless.Persistence.of( Person ).save( personObject );
}

Our javascript/html knowledge and experience are still limited. We’d really appreciate your help. Thanks.

Thank you. We’ve got this bit sorted.