HTMLViewer: how to set a value to a field ?


I have an html viewer, loaded with an url, and I would like to fill some fields on that page automaticaly.

I tried to use :

jsSrc = "document.getElementById(""MainContent_ddlCountry"").value=""13"";" w.myHTMLViewer.ExecuteJavaScript(jsSrc)
but the field (a popup menu with 34 values) is not set.

I also tried with a text field with no success
what did I miss or is it even possible ?

also, how could I check for possible errors coming back from javascript ?

please note that the url is a public access, not something I have a programming access.


Well if it’s a popup menu, you’ll actually need to select a row, not set a value.

As for getting errors, you could wrap your JavaScript code in a try-catch and pass the text of the exception back through the title or status.

Unfortunately JavaScript is very tolerant of bad behavior, so these may not throw an error anyway.

Jean-Yves: I may be wrong, but I copied below a simple html I built month ago as a search matter for something I throw away… (lack of results and lack of time).


Essai masque de saisie

Essai masque de saisie



Citroën: Berlingo Peugeot: Express (?) Fiat: Doblo Renault: Kango

Genre: Homme Femme


I think that I found data in this site:

I hope this helps.

well, for the records, it’s not a popup menu but a combobox.
I had to set the “text” property instead of “value” like above
and set to the real “France” instead of “13”
and the field has been set.