I have a few pages with a simple Server Connect Post form.
The form contains a few input text fields and a file upload item which is not mandatory.
When I post the form with only the (required) text fields the data is being saved in the database.
When I also choose a file to upload I get the response error form the api that the text fields are required.
It seems that no form data is being posted to the server.
Now, I don’t know if this is the correct way to upload a file using a post form in a fw7 project.
Or is there something else not correcty setup?
The same form I have on the website is working as it should.
Perhaps someone knows what might be going on here?
Thanks Ben for your reply,
I probably gave the wrong impression regarding multiple forms.
I mean I have similar forms at various places in the app. It is not a multi-page form
The enctype="multipart/form-data" is required for file uploads, it has nothing to do with multi-page forms, it is how the form data is submitted to the server.
So i tried the following:
I copied the working BS5 form from the website project
Created a new BS5 mobile app and pasted the code to the page.
Adjusted the server connect link to the web api
This produces the same error
This means the serverside validation is triggered, so there are post variables with these names which receive no value, but have required validation applied.
Are you 100% sure your form input names are the same as the POST variable names? emailfirst_namelast_name ?
Could it be that the api is triggered while data is still transferring to the server?
In that case the variables have not reached the server yet.
When using the same form on a mobile phone using a web browser, it is also working fine.
I don’t see anything wrong with the code, check with devtools if the data is actually correctly send to the server, the error shows a validation error that the email, first_name and last_name are missing in the request.
Is it specific iOS or Android where it is not working? The request looks fine and you already told that it works in the browser, so it should be something specific with cordova.