I am new to programming with vb2008 and I am trying to fill out a form on line. The form looks for keystrokes and keeps track of the number of characters typed. There are two elements on the form that use this method. The first area will allow me to fill in the data using the usual method of setting the attribute “value” of the field as the data I wish to insert. But the characters are not counted. The second area does not fill at all.
The code for the fields are as follows.

<div id="fck_editor">
<input type="hidden" id="body" name="body" value="" style="display:none" /><input type="hidden" id="body___Config" value="" style="display:none" /><iframe id="body___Frame" src="/includes/js/fckeditor2.6.4/editor/fckeditor.html?InstanceName=body&amp;Toolbar=Default" width="649" height="410" frameborder="0" scrolling="no"></iframe>
<div id="plain_editor" style="display:none;">
<textarea id="body_plain" style="width: 640px; height: 400px"
<div class="text_counter" >
Word Count: <input readonly type="text" id="bodyRemLen" size="10" value="0"> (250 - 5000 words)     
<div id="art_keywords">
<input style="display:block; max-width: 645px;" type="text" name="keywords" id="keywords" maxwidth="125" size="125" value=""
<span id="art_keyword_suggestions" style="display:none;"></span>
<div class="text_counter">
<input readonly type="text" id="keywordsRemLen" size="3" maxlength="3" value="" /> Characters left

My code looks like this.

WebBrowser1.Document.All("body_plain").SetAttribute("value", Body1)
WebBrowser1.Document.All("keywords").SetAttribute("value", KeyWords)

When I tried using the name “body” for the first field nothing happened. When I used “body_plain” the data was filled in but the character count is not working. The second field for key word, I have not found any way to fill in the field.
I would like for the character count to work but have no idea how to even start.

Recommended Answers

All 3 Replies

See what happens if you add the lines in red.

WebBrowser1.Document.All("body_plain").SetAttribute("value", Body1)
WebBrowser1.Document.All("keywords").SetAttribute("value", KeyWords)

It had no effect, same results.

Ah. I'm sorry. Try this instead.

WebBrowser1.Document.All("body_plain").SetAttribute("value", Body1)
Webbrowser1.Document.InvokeScript("modified", New Object() {"body_plain", True})
WebBrowser1.Document.All("keywords").SetAttribute("value", KeyWords)
Webbrowser1.Document.InvokeScript("modified", New Object() {"keywords"})

Here's my reference: http://www.dotnetcurry.com/ShowArticle.aspx?ID=194&AspxAutoDetectCookieSupport=1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.