Page 3 of 5
Trouble getting Update Rest Service to work
Posted: Mon Jul 22, 2013 11:37 am
by ssquire
Thanks Katya! That worked. I'm still missing something though. I still don't see the updated value in the Game Date label when I navigate back to the Game Notes page. Is this because I need to 1st execute a Curl command, in my Javascript, to Update the respective field in my database? (being that the Game Date label is linked to the Game Date field in my database - and that will be loaded when the page is loaded).
Trouble getting Update Rest Service to work
Posted: Mon Jul 22, 2013 1:43 pm
by Kateryna Grynko
Hi Steven,
When you return to another page using Back button or such a mechanism then only Page Show event is triggered. You should call your service on this event.
Trouble getting Update Rest Service to work
Posted: Wed Jul 24, 2013 4:39 pm
by Maryna Brodina
Hello! Sorry for delay. I'll update.
Trouble getting Update Rest Service to work
Posted: Wed Jul 24, 2013 5:09 pm
by Maryna Brodina
You can't put curl command in JS. codecurl -X PUT \ .........../code is a standard record to show what data and where you need to send. In your case (when you're going to update DB) you should call service and transmit data codeserviceName.execute({"data": {"param1": "param1value", "param2": "param2Value"}});/code
Trouble getting Update Rest Service to work
Posted: Wed Jul 24, 2013 7:19 pm
by ssquire
I really hate to appear so ignorant on this, but I am confused. If I create an Update Service with no mapped parameters how will the database know what fields to update? How do I fill in the parameters of the service in order to make the code sample you supplied work?
Trouble getting Update Rest Service to work
Posted: Wed Jul 24, 2013 7:35 pm
by Maryna Brodina
You can pass all parameters in object "data" which you transmit in service call as shown here codeserviceName.execute({"data": {"param1": "param1value", "param2": "param2Value"}});/code
where param1, param2 - request parameters (you can add as many parameters as you need - all fields you're going to update, DB id, session token).
Trouble getting Update Rest Service to work
Posted: Fri Jul 26, 2013 5:01 pm
by ssquire
I have implemented your code snippet and my javascript seems to be failing on service execution. Can you take a look and see if there is anything that jumps out at you. I have shared the project with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a. In particular it is when the 'ok' button is pressed on the "editDateandNotes" popup.
Trouble getting Update Rest Service to work
Posted: Fri Jul 26, 2013 5:07 pm
by Maryna Brodina
Hello! Are there any errors in console when you click 'ok'?
Trouble getting Update Rest Service to work
Posted: Fri Jul 26, 2013 5:21 pm
by ssquire
Yes. When it attempts to call the service the following error message appears:
Uncaught TypeError: Object [object Object] has no method 'execute' startScreen.js:996
$.die.live.click startScreen.js:996
jQuery.event.dispatch jquery-1.8.2.js:3063
elemData.handle.eventHandle
Does this mean I can't call the REST service using the '.execute' method?
Trouble getting Update Rest Service to work
Posted: Fri Jul 26, 2013 6:16 pm
by Maryna Brodina
You have to use not service name, but datasource name in code.