Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
Posts: 38
Registered: ‎01-24-2014
My Device: Q5
Accepted Solution

Passing Information to TextArea from WebView Html

Hello,

 

Can Passing Information to TextArea from WebView Html?

 

Iam using WebView Html can i show body or any element from htlm to TextArea?

 

Webview{
     id: myweb
     html: '<!DOCTYPE html>
            <html>
            <body>
            <p>Hrllo (:.</p>
            </body>
            </html>
                    '
}

Textarea{
         id: mytext
         text: myweb.html
}

 

When use this work but show all html i need show specified element .

 

* I know can use <p> element  in textarea but this for example*

 

Thanks in advance.

 

Developer
Posts: 6,145
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30

Re: Passing Information to TextArea from WebView Html

To pass information between the two you would need to use JavaScript, take a look at evaluateJavaScript for one way of doing it...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__webview.html#function-evalua...


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
New Developer
Posts: 38
Registered: ‎01-24-2014
My Device: Q5

Re: Passing Information to TextArea from WebView Html

@BBSJdev

 

Thanks.

I did it but i do not know how to send JavaScript result to Textarea or label.

 

	Webview {
		id: mywebview
		html: '<!DOCTYPE html>
			   <html>
			   <head>

               </head>
               <body>

               <h1 id="myHeader">Hello!</h1>

               </body>
               </html>
              ';
		onLoadingChanged: {
                if (loadRequest.status ==  WebLoadStatus.Succeeded) {
                    mywebview.evaluateJavaScript('document.getElementById("myHeader")');
                }
            }	
	}

 

Can you explain it or put a simple example? :smileyembarrassed:

 

 

 

New Developer
Posts: 38
Registered: ‎01-24-2014
My Device: Q5

Re: Passing Information to TextArea from WebView Html

up :No:

BlackBerry Development Advisor
Posts: 14,967
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: Passing Information to TextArea from WebView Html

Have a look at ForumThreadItem.qml from my Community 3 sample for an example on how to use evaluateJavaScript to get a value from the contents of a WebView from QML.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker