New Europe
New Europe

Reputation: 31

How to get the Value from a input field in QWebView

In Qt I have a QWebView on the screen the site in the web view has an input field, I want to get the value attribute from the input field and store it in a QString Basically what I'm asking is how can I store the value of a input field in a QString

Upvotes: 2

Views: 1327

Answers (2)

user3466022
user3466022

Reputation: 145

You should use evaluateJavaScript("this.value") for dynamic get calues from attributes: http://www.qtforum.org/article/34091/solved-get-html-dom-dynamic-value-via-qtwebview.html#post109395

Upvotes: 2

Joseph
Joseph

Reputation: 13218

From your QWebView get the QWebFrame (e.g ui->webView()->page()->currentFrame()->toHtml();) and then used QwebFrame::findAllElements or QWebFrame::findFirstElement. This will give you a QWebElement and you can use the attribute method to get the value attribute.

Upvotes: 2

Related Questions