LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controling HTML <form> Radio Button

Solved!
Go to solution

I'm working on automating the check-in and check-out of items in a process queue, but the process queue is web-based. I can input usernames, lot IDs, passwords, and "press" submit buttons programatically by using ActiveX IWebBrowser2 properties (and related).

 

Here's what I currently have, mostly stolen from a post from 2005.

The Old Post:

http://forums.ni.com/t5/LabVIEW/How-to-fill-out-and-submit-a-web-form-using-LabVIEW/m-p/1018248/high...

 

As I said, I can input usernames and passwords and submit the form, but I am having trouble setting the value of a Radio button.

 

Here's a snippit of what I'm trying, and my VI is attached. I've also attached the relevant HTML.

 

web page radio button control.png

 

 

 

Download All
0 Kudos
Message 1 of 7
(4,606 Views)

Hello,

 

Would you mind detailing the difficulties you are having with developing this application?

 

Thanks,

National Instruments
Applications Engineer
0 Kudos
Message 2 of 7
(4,567 Views)

I can't figure out how to change the value of an HTML Radio Button element.

 

In the HTML, each Radio Button element has the same name, "dBase" in this case, and I tried applying the same logic as one would use when changing the value of an HTML Input element. I tried to set value of IHTMLFormElement "dBase" to "SandBox" (the 2nd option) by using the IHTMLElement SetAttribute invoke node. That didn't work. So then I tried changing which item was "checked" via the same method (what is shown above), but that still didn't work.

 

I can't think of any other way to set the value of an HTML Radio Button element.

0 Kudos
Message 3 of 7
(4,547 Views)

@dthor wrote:

I can't figure out how to change the value of an HTML Radio Button element.

 

In the HTML, each Radio Button element has the same name, "dBase" in this case, and I tried applying the same logic as one would use when changing the value of an HTML Input element. I tried to set value of IHTMLFormElement "dBase" to "SandBox" (the 2nd option) by using the IHTMLElement SetAttribute invoke node. That didn't work. So then I tried changing which item was "checked" via the same method (what is shown above), but that still didn't work.

 

I can't think of any other way to set the value of an HTML Radio Button element.


You will not be able to check the radio using the "value" of the radio button.

Radios have the following format in HTML:

 

<input type=radio name="1st Box" value="a">

<input type=radio name="2nd Box" value="b" checked>

<input type=radio name="3rd Box" value="c">

 

Notice in this case, it would be the 2nd radio that was checked.

However, it is not the value that is checked. In fact, I'm not sure what to set, because it isn't really associated with any particular attribute of that element.

 

Sorry I can't help figure out what to set, but hopefully that helped show you what not to try Smiley Tongue

Cory K
Message 4 of 7
(4,538 Views)
Solution
Accepted by dthor

Thanks Cory,

 

I've finally figured out a way to do it: get the IHTMLFormElement info by finding "dBase" name, and then find the 2nd (or nth) item with that name and then "Click" that element. The Radio buttons are 0-indexed (or at least LabView reads them that way), so to click on the 2nd item ("SandBox"), I had to put "1" into the index input of the invoke node.

 

 Radio button example.png

Message 5 of 7
(4,530 Views)

 

  Hello,

I have a html form compounds in two fields first and last name and a sibmit button, how can I control it in labview

 

Download All
0 Kudos
Message 6 of 7
(4,101 Views)

jarjsf,

 

I would recommend creating a new thread for your question as the original question on this thread has already been answered.

James K.
National Instruments
Applications Engineer
0 Kudos
Message 7 of 7
(4,076 Views)