Dijit textbox onfocus



  • I try to launch my virtual keyboard at onfocus events in the html5 page. I use dijit.Form.Textbox as input method. My code is similar to other posts on this forum, e.g. "QML + Webview + virtual keyboard":http://qt-project.org/forums/viewthread/11237

    Evaluating the same javascript code in the Chrome browser works perfectly fine: clicking on the password text box results in a console message 'focus'. However, the evaluating the following Javascript code in QT example results in nothing.

    Anybody an idea?
    @
    void MyWebView::loadFinished(bool issuccessful)
    {
    if (issuccessful) {
    QWebElement document = this->page()->mainFrame()->documentElement();
    QWebElementCollection elements = document.findAll("input");
    foreach (QWebElement element, elements)
    {
    QString type = element.attribute("type");
    if (type == "password" || type == "text") {
    QString name = element.attribute("id");
    QString script = "var elems = document.getElementById("" + name + ""); elems.onfocus = function() { console.log("focus"); };";
    this->page()->mainFrame()->evaluateJavaScript(script);
    }
    }
    }
    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.