QWebElement set and get attribute
-
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");
}@
-
I do not understand the problem. Could you post a small example?
-
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
-
You should not have to use JavaScript there. It could be a bug.
-
[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?
-
[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 :)
-
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
-
Wow, that is weird. Please create a bug, that does not look good at all.
-
[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
-
[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.