Page 2 of 3

How to update input text box with value from database

Posted: Thu May 08, 2014 12:47 am
by Deki

Hi Katya, please see the screenshots I posted above for the List service. This is the service that gets invoked on Page Show. The list service works fine and it lists the correct user data pulled from the database only if there is no change in input box. But, if I change anything in the input box, for example if I clear it out using

Apperyio('inp_weight').val('');

then there is an empty input box that remains constant until I restart the app. So, it's only when I make a change (like clear it) that the list service doesn't work


How to update input text box with value from database

Posted: Thu May 08, 2014 8:45 am
by Evgene Karachevtsev

Helo Deki,

Please provide a public link to your project.


How to update input text box with value from database

Posted: Thu May 08, 2014 1:27 pm
by Deki

Here you go

http://appery.io/app/mobile-frame?src...

some sample user logins are
user: jon
pass: j

user: kim
pass: k

Feel free to log in with on of those users, change some data (i.e. weight) and then log out and log back in with the other user. You will see the problem that the values in input box don't update from list service.

Ignore the "Register" and "Recover Password" buttons...they don't work yet


How to update input text box with value from database

Posted: Thu May 08, 2014 8:36 pm
by Deki

Any progress on this?


How to update input text box with value from database

Posted: Thu May 08, 2014 9:03 pm
by Kateryna Grynko

Hi Deki,

Sorry, not yet, working on it.


How to update input text box with value from database

Posted: Fri May 09, 2014 7:25 am
by Serhii Kulibaba

Hello Deki,

I think you need add item to DB for the user if it is absent and update if it is present. Also show data for concrete user. For doing taht collection with that data should includes column with pointer to users collection.
So:

  • add column user (with ponter to users collection) to collection metrics.

  • on page show event get data for active user (add where request parameter) http://docs.appery.io/documentation/b...

  • on click event handler run read service for active user and on success event this service run code:

    if (data){ // if data is present - update it
    updateService.execute();
    } else { // else - add that data
    createService.execute();
    }


How to update input text box with value from database

Posted: Fri May 09, 2014 1:31 pm
by Deki

Hello Sergiy,

I thought that the acl has the userId and that I don't need to create a separate column for user in the metrics collection? Because I can see that in the acl there is user id there...

So, if I need to create a column user with pointer to users collection - how do I do create this "pointer"?

Thanks


How to update input text box with value from database

Posted: Fri May 09, 2014 2:17 pm
by Kateryna Grynko

Hi Deki,

Add a collection column, then save user id there:
http://docs.appery.io/documentation/b...


How to update input text box with value from database

Posted: Fri May 09, 2014 2:41 pm
by Deki

Hi,

I tried your suggestions above and it still doesn't work. I just don't think it's possible to both read and write/update using the same input box. It works-however it only works if you don't modify the value in the input box. For some reason, once you modify the value, it doesn't update anymore from the list or update service. It just keeps that same value for the duration of the program until you delete it or modify it again.


How to update input text box with value from database

Posted: Mon May 12, 2014 3:20 am
by Yurii Orishchuk

Hi Deki.

I've tryed your app.

And currently:

1 User "kim" not passed "_id" for metrics collection. Url is "https://api.appery.io/rest/1/db/colle..." but should be like: "https://api.appery.io/rest/1/db/colle..."

See screen shots:

1 for jon: http://prntscr.com/3ifvgy/direct

2 for kim: http://prntscr.com/3ifvxi/direct

Thus you have a request error.

So try to fix this problem.

Also please share your app and DB with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and describe how your app should work.

Regards.