Can't add Data on Everlive

2 posts, 0 answers
  1. Renato
    Renato avatar
    1 posts
    Member since:
    Aug 2013

    Posted 13 Aug 2013 Link to this post

    Hello, I'm new in icenium and everlive. I'm having some problems with queries, specially a register query for add some data on everlive.
    I tried to create a data source on my main.js with the table data and put some information on it like this lines:

    dataSource.Name = $('#loginUsername').val();
            dataSource.Password = $('#loginPassword').val();
            dataSource.Gender = $('#loginGender').val();
            dataSource.Email = "";

    but it didn't work, someone can help me with an example step by step?
  2. Viktor Staikov
    Viktor Staikov avatar
    3 posts

    Posted 21 Aug 2013 Link to this post


    Please excuse me for the late response.
    From your code snippet I assume you have seen this in our Hybrid Sample app - Friends. Here I am pasting the original code:

    01.var signup = function () {
    02.    dataSource.Gender = parseInt(dataSource.Gender);
    03.    var birthDate = new Date(dataSource.BirthDate);
    04.    if (birthDate.toJSON() === null)
    05.        birthDate = new Date();
    06.    dataSource.BirthDate = birthDate;
    07.    Everlive.$.Users.register(
    08.        dataSource.Username,
    09.        dataSource.Password,
    10.        dataSource)
    11.    .then(function () {
    12.        showAlert("Registration successful");
    13.        mobileApp.navigate('#welcome');
    14.    },
    15.          function (err) {
    16.              showError(err.message);
    17.          }
    18.    );

    Please bear in mind that the correct property is Everlive.$.Users (not Everlive.$.Clients). This property exposes all methods regarding Users in Everlive.
    Another thing that may lead to error is the .register() method. It takes only three agruments: Username, Password & AdditionalFields (all of them should be objects, more info here). If you with to store Email and Gender as well, you should do it save them as part of the AdditionalFIelds object (the third parameter).

    If this does not solve your problem, please provide me more detail description of what you are doing so I can help you further.

    Viktor Staikov

    Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.

Back to Top