This is a migrated thread and some comments may be shown as answers.

Can't add Data on Everlive

1 Answer 57 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Renato
Top achievements
Rank 1
Renato asked on 13 Aug 2013, 12:42 PM
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 = "sample@sample.com";
            Everlive.$.Client.register(
                dataSource.Name,
            dataSource.Password,
            dataSource.Gender,
                dataSource.Email,
            dataSource)

but it didn't work, someone can help me with an example step by step?

1 Answer, 1 is accepted

Sort by
0
Viktor Staikov
Telerik team
answered on 21 Aug 2013, 12:39 PM
Hello,

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.    );
19.};

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.

Regards,
Viktor Staikov
Telerik

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.


Tags
General Discussion
Asked by
Renato
Top achievements
Rank 1
Answers by
Viktor Staikov
Telerik team
Share this question
or