Form Question

So I’ve been battling this for almost two weeks now. I have a web server that I am trying to send a form to. This form has required fields. I’ve given up trying to send text and files together as I’ve got perfectly working code on the corona simulator (based on http://developer.coronalabs.com/code/how-upload-image-server-multipartform-data) that neither works, nor errors on the xcode simulator or device. 

I’ve tried a native form, posting data to the server, using native.newTextField. This works great to make required fields as you can check on submitting the form, but these text fields are ridiculous to use. They do not work with scrollviews, and doing a manual scrollview (like I do with everything because the scrollview itself is rediculous) doesn’t work because the text fields bunch up like idiots when you scroll.

So now I’m trying to embed a webview, do these webviews not support HTML5? Using the “required” parameter in input text boxes works just fine on browsers, but these native webviews just ignore it. They also do not support javascript. But I need these fields required. 

Any ideas? Is there an alternative to the newTextField that works better? Is there a way to make HTML inputs required?

Thanks

Hi @cxixer.

native.* objects exist in the device’s regular viewport space.  Graphics like we use with OpenGL occupies a different canvas and the two do not interact.  This is why you can’t put them in groups, etc.  The only choice is to manually scroll them.

There is very little interaction between webViews and Corona SDK.  It’s pretty much show it in a box and respond to URL clicks.   Since the webViews (which are also native objects) depend on the OS’s webView controller, they should be based on either Apple’s webkit or Google’s take on webkit.  In both cases most of HTML5’s features should be supported. However in the HTML 5 world, mobile webkit is slightly behind desktop webkit and a lot of the cool HTML5 form processing is what is lagging.   But even if you could get an HTML5 form to work, I doubt it would be able to access files in your apps’ sandbox for uploading.

@rob,

Thank you for your quick reply. I understand that these native objects work on top of OpenGL, I just wish they were a bit easier to work with. For example, see this picture. After not being able to add them to the scrollview, I manually created a slider for the inputs, the same way I’ve done for every other slider I’ve created because the scrollview is difficult to work with. So the object is to make this work like every other app you’ve ever used in your life, scroll, and when it hits the limit as you scroll past, it comes back to the limit and rests nicely. When I do that with multiple inputs, they bunch up at the edge of the screen, the bottom or top depending on which way you are scrolling. 

Not sure if I am being over picky here in trying to stretch this 2d game dev SDK to make business apps, as it works well for what it was intended to do for the most part. But as I’ve seen others abandon corona for other tools like titanium, I may have to do as well. From an initial reading, titanium seems to support the things I’m after such as transfering information between the device and webviews, javascript and other technologies in webviews, and was intended it seems for business apps instead of games, which is more what I need.

No other ideas on how I can make my forms work?

Hi @cxixer.

native.* objects exist in the device’s regular viewport space.  Graphics like we use with OpenGL occupies a different canvas and the two do not interact.  This is why you can’t put them in groups, etc.  The only choice is to manually scroll them.

There is very little interaction between webViews and Corona SDK.  It’s pretty much show it in a box and respond to URL clicks.   Since the webViews (which are also native objects) depend on the OS’s webView controller, they should be based on either Apple’s webkit or Google’s take on webkit.  In both cases most of HTML5’s features should be supported. However in the HTML 5 world, mobile webkit is slightly behind desktop webkit and a lot of the cool HTML5 form processing is what is lagging.   But even if you could get an HTML5 form to work, I doubt it would be able to access files in your apps’ sandbox for uploading.

@rob,

Thank you for your quick reply. I understand that these native objects work on top of OpenGL, I just wish they were a bit easier to work with. For example, see this picture. After not being able to add them to the scrollview, I manually created a slider for the inputs, the same way I’ve done for every other slider I’ve created because the scrollview is difficult to work with. So the object is to make this work like every other app you’ve ever used in your life, scroll, and when it hits the limit as you scroll past, it comes back to the limit and rests nicely. When I do that with multiple inputs, they bunch up at the edge of the screen, the bottom or top depending on which way you are scrolling. 

Not sure if I am being over picky here in trying to stretch this 2d game dev SDK to make business apps, as it works well for what it was intended to do for the most part. But as I’ve seen others abandon corona for other tools like titanium, I may have to do as well. From an initial reading, titanium seems to support the things I’m after such as transfering information between the device and webviews, javascript and other technologies in webviews, and was intended it seems for business apps instead of games, which is more what I need.

No other ideas on how I can make my forms work?