Prefilled Input in Webview?

Greetings Corona community

I am working on a project that I need to prefill some input areas of a website (but not to send) 

An example:

1-You have a= “abc”.

2-The user enters google with webview inside the app.

3-The search area of it already is filled with “abc” by the app.

4-The user only needs to push the search button or the user can change the input.

I need it for Drupal based sites which are integrated with Corona. Google is just an example. It is really important for forms

Reasons: I don’t have experience with databases and I am a bit afraid to enter database issues… So I am trying to do it with filling inputs and let the user to push the button or change the content.

I doubt you’re going to be able to do this with Corona SDK or a webview. But if you have control over the web form and the ability to code JavaScript on the page, it might be possible to use something like jQuery to fill out the fields based on query parameters on the end of the requested URL to fill out the webView. Corona could dynamically build the URL with these query values.

But you’re going to have to have programming access to the page generating the form.

Rob

Thanks again Rob!

Yesterday Lerg showed me a way to solve it with saving the page as html and give a fake page to the user. But I doubted about if I can fill the input of it by that way.

According to your answer, I found a solution with opposite research. So I would like to share it.

I uses Drupal. This content which is about webforms (https://www.drupal.org/node/296453) can show better way but I would like to share my way.

function myApp.enterweb( url) if networkConnection() == true then myApp.webView = native.newWebView(0, 0, display.contentWidth, display.contentHeight-145) myApp.webView:addEventListener("urlRequest", onWebViewEvent) myApp.webView:request( url ) else local alert = native.showAlert( alert,"Check your internet.", { "Ok" }, onAlertComplete ) myApp.showScreen1() end myApp.webView.x = display.contentWidth/2 myApp.webView.y = (display.contentHeight-145)/2+65 end myApp.enterweb("www.asdasdasdasd.com/node/2?testtitle=asd")

In the drupal side of it, you need following modules:

Tokens,

Webview

When you create a new webfrom, enter webfrom tab and in the default value, click tokens and choose [current-page:query:?] and change ? to your value ([current-page:query:testtitle] 

In the end, when you redirect the user via webview with ?testtile=value , you will send an information with it.

It doesn’t look like a Corona based solution but Drupal based solution :ph34r: . I am not really sure that this will help about any internet site but I hope this will help to other developers in the future  :) 

I doubt you’re going to be able to do this with Corona SDK or a webview. But if you have control over the web form and the ability to code JavaScript on the page, it might be possible to use something like jQuery to fill out the fields based on query parameters on the end of the requested URL to fill out the webView. Corona could dynamically build the URL with these query values.

But you’re going to have to have programming access to the page generating the form.

Rob

Thanks again Rob!

Yesterday Lerg showed me a way to solve it with saving the page as html and give a fake page to the user. But I doubted about if I can fill the input of it by that way.

According to your answer, I found a solution with opposite research. So I would like to share it.

I uses Drupal. This content which is about webforms (https://www.drupal.org/node/296453) can show better way but I would like to share my way.

function myApp.enterweb( url) if networkConnection() == true then myApp.webView = native.newWebView(0, 0, display.contentWidth, display.contentHeight-145) myApp.webView:addEventListener("urlRequest", onWebViewEvent) myApp.webView:request( url ) else local alert = native.showAlert( alert,"Check your internet.", { "Ok" }, onAlertComplete ) myApp.showScreen1() end myApp.webView.x = display.contentWidth/2 myApp.webView.y = (display.contentHeight-145)/2+65 end myApp.enterweb("www.asdasdasdasd.com/node/2?testtitle=asd")

In the drupal side of it, you need following modules:

Tokens,

Webview

When you create a new webfrom, enter webfrom tab and in the default value, click tokens and choose [current-page:query:?] and change ? to your value ([current-page:query:testtitle] 

In the end, when you redirect the user via webview with ?testtile=value , you will send an information with it.

It doesn’t look like a Corona based solution but Drupal based solution :ph34r: . I am not really sure that this will help about any internet site but I hope this will help to other developers in the future  :)