I have a mobile app with a backend API project. I am able to display data from the backend in my mobile app. What I cannot figure out is how to do DB Inserts from my mobile app. From what I understand is that I need a local SQLight DB for my mobile app and that it needs to sync with my backend DB.
Docs are sparse on this subject. So I was hoping someone can point me in the right direction here.
In this regard mobile apps are no different than web. You create a server connect form that has an API on the server for processing the insert. When choosing the API, make sure to select the applicable project first (upper right corner of the dialog box.)
Yes I am able to do that, the problem Im running into is that in the server actions itself, I am unable to import the post variables from the form in my mobile app. It cannot find the form
I’ve never tried to import a form from a mobile project…but you can try and browse to your mobile project folder and open the file. If it’s coming up empty, you can add your POST inputs manually.
I am still a little stuck here. So when I hit submit on the form in my mobile app, the web API DB creates the record but does not insert the post variables.
I created the variable in the server action, and set the linked field as the name of the input in the form. (Also tried ID of the input)
I feel like I am missing a step somewhere. I can’t import the form into the server action because the form is in my mobile app.
So I guess the question is, how do I tell the manually created POST variables to take data from the inputs in the mobile app form?
On each input in your form you have a id attribute and a name attribute, the name attribute on the input should be the same as the POST variables you created in the server action.
That is correct. I have a form inside my mobile app. It contains an input with the name input1 (just an example). The form is linked up with a server connect action with my insert server action.
On my backend web app, I have that server action setup to insert the value of input1 into a table called names…again just an example.
Inside that server action, I am unable to set the page the form is on under linked page, therefore I am unable to import from form as the page is on my mobile app, not my backend app.
So I manually created a POST variable named input1
So when I run that action by clicking the submit button on the form, a new record is created on the names table with a new id however their input1 column is empty.