Activate radio button on htmlviewer

Hi everybody
My desktop apps is to help internal staff to fill up web form
I use javascript .click() to select radio button
But the website (Form) should react immediately to this selection (And popup a message… that i need to automate the click enter)
The radio button is click on screen But nothing happend ( The click seems to be cosmetic only )
How can i simulate a real click to have a instant response
HTMLViewer1.ExecuteJavaScript"document.getElementsByName('radiobalign')["+RBradiobalign+"].click();"//radio Button
Thanks

Does it react how you expect when you javascript inject in a browser?
Try it, go to the page, and put in the url bar:

javascript:document.getElementsByName('radiobalign')[x].click();

of course you need to change x to whatever value that’s supposed to be.

my mistake is not a radio button But a Check box… and no, it doesn’t react like i expect
I can see the javascript in the website onclick='return chkDisplay(this)'
So i try this …but have syntax error

HTMLViewer1.ExecuteJavaScript"document.getElementsByName('checkalign')[0].checked='return chkDisplay(this)'";

i dont know how put together the checked and return…chkDisplay(this)

In Javascript this refers to the item itself, and only that item can use it.
You would probably need something like

chkDisplay(document.getElementsByName('checkalign')[0])

I’m not 100% sure you can inline a document.getElementsByName, so you may have to set up a var and refer to it.

For giggles, an attempt:

var myCheckBox = document.getElementsByName('checkalign')[0]; myCheckBox.checked=true; chkDisplay(myCheckBox);

Let me know if that works, I’d like to reward myself if it does :stuck_out_tongue:

ho yes Tim it work!!

HTMLViewer1.ExecuteJavaScript"var myCheckBox = document.getElementsByName('checkalign')[0]; myCheckBox.checked=true;" HTMLViewer1.ExecuteJavaScript"chkDisplay(myCheckBox);"
Now i have to click the “yes” button who’s inside that popup message
can i only key stroke enter or target the button itself ( dont know how call the yes button object )
Thank Tim