Iphone webapp

Hi guys,

I wasn’t sure where to post this or if anyone would actually be able to help but here goes anyway…

basically, ive made a web app which is just a glorified web form - user fills in the fields then presses the submit button, the data is then passed to a web server for processing in the appropriate manner. The problem i have is that some times when i try to submit the form i may be out of signal but the app ‘submits’ anyway. The data then doesn’t get passed to the web server.

What i would like if possible is:

a) Check for a data connection before submitting the form.
b) Store the data locally (iphone) for re-submit later on when in signal.

Could anyone suggest any ways of going about doing these 2 things please?

Thanks in advance.

In all honestly I’m not sure whether you can with a web app; I mean query whether there is an active and live connection. Though using javascript you should be able to discover whether there is.

Just to deviate slightly, with a native app you would listen for a success response when you post something to the server - so the server talks to the app; if there is no server response then you know the server is unavailable. You wouldn’t just check for a data connection to be live as that can be unreliable; you need a success response.

You need to check that the transfer can and has been made. Remember if someone is on the move they could have a connection but it could be so poor that it is unreliable. In which case it might make sense to store the data.

You could do something similar to that with javascript; so use javascript (jQuery/AJAX) to connect to the server side script and wait for the reply, if it times out; then take an alternative action.

With saving the data, with native apps and web apps you can access local storage; using HTML 5: http://paperkilledrock.com/2010/05/html5-localstorage-part-one/

I had initially looked at using the localstorage option but the only problem i can see there is that one of the bits of information i need to store is an image. I cant see a way of storing it. As for the javascript option that is still something i am looking into and was looking at maybe - when the submit button is pressed some data or a file is downloaded from the server, if it downloads the form submits, if not it errors… so hopefully i can come up with something there.

Thanks again for the help tho.