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>
<div id="plain_editor" style="display:none;">
<textarea id="body_plain" style="width: 640px; height: 400px"
onKeyDown="modified('body_plain',true);"
onKeyUp="modified('body_plain',true);"
></textarea>
</div>
<div class="text_counter" >
Word Count: <input readonly type="text" id="bodyRemLen" size="10" value="0"> (250 - 5000 words)     
</div>
<div id="art_keywords">
<input style="display:block; max-width: 645px;" type="text" name="keywords" id="keywords" maxwidth="125" size="125" value=""
onKeyDown="modified('keywords');"
onKeyUp="modified('keywords');">
<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
</div>
</div>

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.

Re: filling out web form with character count 80 80

See what happens if you add the lines in red.

WebBrowser1.Document.All("body_plain").SetAttribute("value", Body1)
Webbrowser1.Document.InvokeScript("modified('body_plain',true)")
WebBrowser1.Document.All("keywords").SetAttribute("value", KeyWords)
Webbrowser1.Document.InvokeScript("modified('keywords')")
Re: filling out web form with character count 80 80

It had no effect, same results.

Re: filling out web form with character count 80 80

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.