[RESOLVED] Can't post to <textarea> tag name
I get this from the source code:
HTML Code:
<div class="row-fluid">
<div class="span12 ">
<div class="control-group">
<label class="control-label" for="firstName">Description</label>
<div class="controls">
<textarea class="m-wrap span12 wysiwyg" style="height:300px;" id="listing_description" name="listing_description">
</textarea>
</div>
I get this from firebug:
HTML Code:
<label class="control-label" for="firstName">Description</label>
<div class="controls">
<div class="redactor_box">
<ul id="redactor_toolbar_0" class="redactor_toolbar">
<iframe frameborder="0" style="width: 100%; min-height: 200px; height: 400px;">
<html>
<head>
</head>
<body contenteditable="true" dir="ltr">
<p></p> 'NOTE: This is where manual typing appears
</body>
</html>
</iframe>
<textarea id="listing_description" class="m-wrap span12 wysiwyg" name="listing_description" style="height: 300px; display: none;" dir="ltr"> </textarea>
My source code looks like this:
Code:
If (WebBrowser1.Document IsNot Nothing) Then
Dim Elems As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("textarea")
For Each elem As HtmlElement In Elems
Dim NameStr As String = elem.GetAttribute("id")
If NameStr = "listing_description" Then elem.SetAttribute("value", Form1.TextBoxReturns.Text & Form1.TextBoxExtra.Text)
Next
End If
Doesn't work. I even tried this...
Code:
If (WebBrowser1.Document IsNot Nothing) Then
Dim Elems As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("iframe")
For Each elem As HtmlElement In Elems
Dim NameStr As String = elem.GetAttribute("style")
If NameStr = "width: 100%; min-height: 200px; height: 400px;" Then elem.SetAttribute("value", Form1.TextBoxReturns.Text & Form1.TextBoxExtra.Text)
Next
End If
No results either. What am I not doing?
Re: Can't post to <textarea> tag name
For frames I use something like,...
Code:
Dim Elems As HtmlElementCollection = WebBrowser1.Document.Window.Frames("frame_name").Document.GetElementsByTagName("tag_name")
Re: Can't post to <textarea> tag name
I would too, but there is no name for this iframe.
Re: Can't post to <textarea> tag name
Maybe loop thru the Frames collection and find out where it is in the array, , something like in post #5...
http://www.vbforums.com/showthread.p...=1#post4271135
Re: Can't post to <textarea> tag name
Well, this didn't work. It is at index 0 though, without a doubt. There are 4 frames on the page, and only one has no name or id.
Code:
WebBrowser1.Document.Window.Frames(0).WindowFrameElement.InnerHtml = Form1.TextBoxReturns.Text & Form1.TextBoxExtra.Text
Re: Can't post to <textarea> tag name
Success. This worked.
Code:
Dim upperHTML As String = "<body contenteditable='true' dir='ltr'><p>"
Dim lowerHTML As String = "</p></body>"
'listing_description
WebBrowser1.Document.Window.Frames(0).WindowFrameElement.OuterHtml = upperHTML & Form1.TextBoxReturns.Text & Form1.TextBoxExtra.Text & lowerHTML
Now I just have to format everything to html.