Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QWebElement set and get attribute
Forum Updated to NodeBB v4.3 + New Features

QWebElement set and get attribute

Scheduled Pinned Locked Moved Qt WebKit
10 Posts 2 Posters 9.9k Views 1 Watching
  • 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 Offline
    2 Offline
    2beers
    wrote on last edited by
    #1

    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
    0
    • B Offline
      B Offline
      benjamin.poulain
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • 2 Offline
        2 Offline
        2beers
        wrote on last edited by
        #3

        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
        0
        • B Offline
          B Offline
          benjamin.poulain
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • 2 Offline
            2 Offline
            2beers
            wrote on last edited by
            #5

            [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
            0
            • B Offline
              B Offline
              benjamin.poulain
              wrote on last edited by
              #6

              [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
              0
              • 2 Offline
                2 Offline
                2beers
                wrote on last edited by
                #7

                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
                0
                • B Offline
                  B Offline
                  benjamin.poulain
                  wrote on last edited by
                  #8

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

                  1 Reply Last reply
                  0
                  • 2 Offline
                    2 Offline
                    2beers
                    wrote on last edited by
                    #9

                    [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
                    0
                    • B Offline
                      B Offline
                      benjamin.poulain
                      wrote on last edited by
                      #10

                      [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
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved