Solved

Checkbox on webbrowser control

Posted on 2014-01-21
2
326 Views
Last Modified: 2014-02-05
When I need to check a checkbox in a webbrowser control I usually:

WebBrowser2.Document.All.Item("the_value").Checked = True

But in this case, the name is strange:

        <input value="8041787595" type="checkbox" name="photos[group1.photo_ids]" />

Any Ideas?
0
Comment
Question by:hrolsons
2 Comments
 
LVL 27

Accepted Solution

by:
Ark earned 500 total points
ID: 39799181
Looks like server-side (asp/php) error - seems developer expected set the name from an array 'photos' by 'group1.photo_ids' index but by mistake use string variable "photos[group1.photo_ids]" in quotes instead of photos[group1.photo_ids] value.
To get the DOM element you can use it as a string
WebBrowser2.Document.All.Item("photos[group1.photo_ids]").Checked = True
but when developer correct his mistake you'll need change it to real name which stored on server in photos[] array
0
 

Expert Comment

by:anwarul
ID: 39802280
function selectAll(invoker) {

            var IsChecked = invoker.checked;
            var inputElements = document.getElementsByTagName('input');

            if (invoker)
                for (var i = 0; i < inputElements.length; i++) {
                    var myElement = inputElements[i];

                    if (myElement.type === "checkbox") {

                        if (IsChecked) {
                            if (!myElement.checked) {
                               //do waht you want
                            }

                        }
                        else {
                            if (myElement.checked) {
                               //do waht you want
                            }

                        }

                    }
                }
        }

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now