Results 1 to 6 of 6

Thread: [RESOLVED] Can't post to <textarea> tag name

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2014
    Posts
    57

    Resolved [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?
    Last edited by teamster; Jul 13th, 2015 at 11:33 PM. Reason: solved

  2. #2
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    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")

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2014
    Posts
    57

    Re: Can't post to <textarea> tag name

    I would too, but there is no name for this iframe.

  4. #4
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    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

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2014
    Posts
    57

    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

  6. #6

    Thread Starter
    Member
    Join Date
    Dec 2014
    Posts
    57

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width