Setting aDrop down list in a Webviewer form

I’m trying to populate a drop down list on a web page.
I have been able to get other type of fields to work but not drop downs.
The others that work I used MBS Webviewer functions but couldn’t get them to work with drop downs.

Here are some details. I have never used java. Feel free to laugh at how wrong this may be!!

Webviewer Name is - Web
I think the item is - #ad_item_822_3913_0_0

MBS Form utility gives me this -

MBS( "WebView.SetFormInputValue" ; $WebViewerRef; 1; "ad_item_822_3913_0"; $Value )MBS( "WebView.SetFormInputValue" ; $WebViewerRef; 1; "ad_item_822_3913_0"; $Value )

I have tried this with no luck -
MBS( "WebView.SetFormInputValue" ; "Web"; 1; "ad_item_822_3913_0"; 3 )

My latest of many Script attempts:



webViewerName = "Web";

windowRef = MBS("Window.FindByTitle"; Get ( WindowName ));

webViewerID = MBS("WebView.FindByName"; windowRef; webViewerName)



webViewerID = 0; "Web Viewer "" & webViewerName & "" Not Found: " &windowRef ;

MBS("WebView.RunJavaScript"; webViewerID; "document.misADForm.#ad_item_822_3913_0_0.selectedIndex =1" ) )


The Html for the Drop down is -

You could try a variant in your last line of non-trivial code shown above.

Instead of:

MBS("WebView.RunJavaScript"; webViewerID; "document.misADForm.#ad_item_822_3913_0_0.selectedIndex =1" ) )

Try something like:

MBS("WebView.RunJavaScript"; webViewerID; "document.forms.misADForm.elements.ad_item_822_3913_0_0.selectedIndex = 1" ) )


MBS("WebView.RunJavaScript"; webViewerID; "document.forms[ 'misADForm' ].elements[ 'ad_item_822_3913_0_0' ].selectedIndex = 1" ) )

Note that these suggestions are just guesses based on what I think you are trying to do, what I imagine the MBS function does, and what I am guessing the HTML in the target page looks like. So, safe to say that there is a fair amount of speculation going into the above.

Hope this helps, and good luck!

p.s. I paid a little bit more attention to the name of this plugin function, and realized that there could be a companion function more appropriate for setting the Select element.

Turns out there is. Per docs on @MonkeybreadSoftware 's site:

p.s. Sorry that I had to delete the post above with the welcome to the Soup. The forum software prohibits me from three consecutive replies (perfectly reasonable restriction), so I deleted that one in hopes that it would help me post this. Welcome to the Soup!

You can always edit one of your earlier posts if it makes sense to do that.

1 Like

I would also suggest trying WebView.SetFormSelectValue function.

That code basically only loops over the items in the popup and then on a match sets selected flag on it.

Does that work?

1 Like