Deki
Posts: 0
Joined: Tue Apr 15, 2014 4:53 pm

How to update input text box with value from database

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

How to update input text box with value from database

Helo Deki,

Please provide a public link to your project.

Deki
Posts: 0
Joined: Tue Apr 15, 2014 4:53 pm

How to update input text box with value from database

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

Deki
Posts: 0
Joined: Tue Apr 15, 2014 4:53 pm

How to update input text box with value from database

Any progress on this?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to update input text box with value from database

Hi Deki,

Sorry, not yet, working on it.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

How to update input text box with value from database

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();
    }

Deki
Posts: 0
Joined: Tue Apr 15, 2014 4:53 pm

How to update input text box with value from database

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How to update input text box with value from database

Hi Deki,

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

Deki
Posts: 0
Joined: Tue Apr 15, 2014 4:53 pm

How to update input text box with value from database

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.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How to update input text box with value from database

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.

Return to “Issues”