Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QWebElement set and get attribute

    Qt WebKit
    2
    10
    9291
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 2
      2beers last edited by

      Hi everyone. Just started playing with qt webkit and I'm facing a little problem. I started to modify this example: http://doc.qt.nokia.com/4.7/webkit-formextractor.html

      and when I press a PushButton I want to change the value of an input html element and it works if I don't change manually the value from webkit widget. Do I need to make some refresh or something??

      here is what I'm doing:

      @void Form::submitInfo()
      {
      QWebFrame *frame = ui->webView->page()->mainFrame();

      QWebElement firstName = frame->findFirstElement("#firstname");
      
      firstName.setAttribute("value","some text");
      

      }@

      1 Reply Last reply Reply Quote 0
      • B
        benjamin.poulain last edited by

        I do not understand the problem. Could you post a small example?

        1 Reply Last reply Reply Quote 0
        • 2
          2beers last edited by

          well on the HTML side I have something like this:
          @<input tye="text" id="firstname" value="" />@

          so when I press a QPushButton I want to change the value of this element to "some text"

          I realized it works with something like this
          @QWebFrame *frame = ui->webView->page()->mainFrame();

          QWebElement firstName = frame->findFirstElement("#firstname");
          firstName.evaluateJavaScript("this.value='some text' ").
          

          @

          but I'm interested if I can change the value without using javascript.

          Thanks

          1 Reply Last reply Reply Quote 0
          • B
            benjamin.poulain last edited by

            You should not have to use JavaScript there. It could be a bug.

            1 Reply Last reply Reply Quote 0
            • 2
              2beers last edited by

              [quote author="Benjamin Poulain" date="1296228818"]You should not have to use JavaScript there. It could be a bug.[/quote]

              well it can change first time I pressed the QPushButton using
              @ firstName.setAttribute("value","some text");@ but if I try to change the input text from the webkit widget and then press the QPushButton nothing happens.

              Do you think I should submit the bug?

              1 Reply Last reply Reply Quote 0
              • B
                benjamin.poulain last edited by

                [quote author="2beers" date="1296229025"]
                @ firstName.setAttribute("value","some text");@ but if I try to change the input text from the webkit widget and then press the QPushButton nothing happens.

                Do you think I should submit the bug?[/quote]

                You can create a bug with http://webkit.org/new-qtwebkit-bug or post an example here. In both cases, you will have to make a reduction and I will review it so I do not mind which channel you use :)

                1 Reply Last reply Reply Quote 0
                • 2
                  2beers last edited by

                  http://www.mediafire.com/?erroif6ubllbubd here is a small project to see how it happens.

                  here is a youtube video to see when the error appears: http://www.youtube.com/watch?v=2R63Me6CuI4

                  1 Reply Last reply Reply Quote 0
                  • B
                    benjamin.poulain last edited by

                    Wow, that is weird. Please create a bug, that does not look good at all.

                    1 Reply Last reply Reply Quote 0
                    • 2
                      2beers last edited by

                      [quote author="Benjamin Poulain" date="1296238383"]Wow, that is weird. Please create a bug, that does not look good at all.[/quote]

                      not sure if it's in the right section but you can change that if you want: https://bugs.webkit.org/show_bug.cgi?id=53319

                      1 Reply Last reply Reply Quote 0
                      • B
                        benjamin.poulain last edited by

                        [quote author="2beers" date="1296244812"]
                        not sure if it's in the right section but you can change that if you want: https://bugs.webkit.org/show_bug.cgi?id=53319[/quote]

                        That is all good. Thanks for the bug report.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post