Jump to content

Reading a specific attribute of an IE element.


ComradVlad
 Share

Recommended Posts

Hey guys,

Im trying to write a program that basically checks that if one checkbox is checked, than another corresponding checkbox is checked as well. However the site im working with is a bit beyond my level of expertise. Here is one of the fields in question and its HTML:

UwZ7nhS.jpg

<span class="blueText">Shower:</span>
                            </td>
                        </tr>
                        <tr valign="top">
                            <td width="12%">&nbsp;</td>
                            <td width="2%">
                                <input type="hidden" name="hiddenField(hhapc_ShowerChair_Chk)"><input type="checkbox" name="value(hhapc_ShowerChair_Chk)" value="on" checked="checked" disabled="disabled" id="hhapc_ShowerChair_Chk" class="checkbox-field disabled"><input type="hidden" name="value(hhapc_ShowerChair_Chk)" value="on"><td>    
                                 <label class="blueText" for="hhapc_ShowerChair_Chk">Use shower chair</label>
                            </td>
                        </tr>
                   </table>
                </td>
                <td align="center">
                     <input type="hidden" name="hiddenField(hhapc_Shower_Chk)"><input type="checkbox" name="value(hhapc_Shower_Chk)" value="on" checked="checked" disabled="disabled" class="checkbox-field disabled"><input type="hidden" name="value(hhapc_Shower_Chk)" value="on"></td>
                <td>
                    <table cellpadding="0" cellspacing="0" width="100%" style="table-layout:fixed">
                        <tr>
                            <td>
                                <input type="text" name="value(hhapc_ShowerFreq_Txt)" maxlength="30000" value="" readonly="readonly" style="width:100%" class="text-field readonly"></td>
                        </tr>
                    </table>
                </td>
                <td>
                    <table cellpadding="0" cellspacing="0" width="100%" style="table-layout:fixed">
                        <tr>
                            <td>
                                <input type="text" name="value(hhapc_ShowerNote_Txt)" maxlength="30000" value="" readonly="readonly" style="width:100%" class="text-field readonly"></td>
                        </tr>
                    </table>
                </td>
                <td align="center">
                     <input type="hidden" name="hiddenField(hhapc_ShowerPerform_Chk)"><input type="checkbox" name="value(hhapc_ShowerPerform_Chk)" value="on" checked="checked" class="checkbox-field"></td>
                <td>
                    <table cellpadding="0" cellspacing="0" width="100%" style="table-layout:fixed">
                        <tr>
                            <td>
                                <input type="text" name="value(hhapc_ShowerPerform_Txt)" maxlength="30000" value="" style="width:100%" class="text-field"></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>

 

I can get the element by its ID which is "hhapc_ShowerChair_Chk" but I'm not sure how to see if it is checked. Furthermore I cant seem to be able to get the other checkbox objects.  "hhapc_Shower_Chk" and "hhapc_ShowerPerform_Chk". Are they part of the first object or are they separate objects entirely? Basically is it possible to check that if hhapc_Shower_Chk is checked, than hhapc_ShowerPerform_Chk is checked as well?

Edited by ComradVlad
Link to comment
Share on other sites

25 minutes ago, ComradVlad said:

I can get the element by its ID which is "hhapc_ShowerChair_Chk" but I'm not sure how to see if it is checked.

Take a look at _IEFormElementCheckBoxSelect in the help file.

29 minutes ago, ComradVlad said:

Furthermore I cant seem to be able to get the other checkbox objects.  "hhapc_Shower_Chk" and "hhapc_ShowerPerform_Chk". Are they part of the first object or are they separate objects entirely? Basically is it possible to check that if hhapc_Shower_Chk is checked, than hhapc_ShowerPerform_Chk is checked as well?

Have you tried with _IEGetObjByName? These fields are oddly named (probably because of some javascript framework), but I would try like this --

$oElement = _IEGetObjByName($oIE, "value(hhapc_ShowerPerform_Chk)")

 

Link to comment
Share on other sites

1 hour ago, Danp2 said:

Take a look at _IEFormElementCheckBoxSelect in the help file.

Have you tried with _IEGetObjByName? These fields are oddly named (probably because of some javascript framework), but I would try like this --

$oElement = _IEGetObjByName($oIE, "value(hhapc_ShowerPerform_Chk)")

 

Well that worked... Simple enough lol, thought it would be way more complicated. Then just calling object.checked will return true if checked and false if not checked. I was overthinking things. Thanks!

Link to comment
Share on other sites

1 hour ago, ComradVlad said:

Well that worked... Simple enough lol, thought it would be way more complicated. Then just calling object.checked will return true if checked and false if not checked.

You should also be able to use this object with _IEFormElementCheckBoxSelect like the first one.

1 hour ago, ComradVlad said:

I was overthinking things. Thanks!

You're welcome!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...