1

in Blackberry Cascades (C++, QT, QML), I am trying to read the html of a webview - but it is returning blank. This webview uses "setUrl(url") to set the url, and does not use "setHtml(html)". Anyway - I have this code:

WebView {
    id: loginView
    objectName: "loginView"
    onMicroFocusChanged: {
        console.log("html: " + html);
    }
}

And the webview url has two textfields, and when I put my cursor into those text fields or when I type in them, the html of the webview shows up as blank - but I need to see the html, because I am trying to be able to parse that html to get the content of those textfields.

How come the html is blank - and how can I get access to this html?

Sunseeker
  • 1,503
  • 9
  • 21
user1296259
  • 521
  • 1
  • 13
  • 33

1 Answers1

0

The Html property of the WebView only returns the code that was inserted with setHtml. (Documentation) Even if it did report code loaded from a web address, I doubt it would be updated with the current value of textboxes.

To read their content, I recommend you look into the messageReceived signal of the WebView. If you can change the html-code that contains your text boxes, you can use javascript navigator.cascades.postMessage() to send the data to your application.

If you do not control the html, you can still use the evaluateJavaScript method to extract the values of the textboxes with DOM functions from inside your app.

Wutz
  • 2,246
  • 13
  • 15