PDA

View Full Version : Controlling web checkbox and buttons FORM type POST



mctabish
07-09-2009, 10:07 AM
I am working on a project an am running into a few hurdles.:banghead:

I am not sure HOW to control it as it is a little
different then what I have worked with before (lots of check boxes):dunno
In the past, in order to "stuff" a value, I have been able to use the syntax
of


With IE.Document.Formname
.VarName.Value = XYZ
end with


or to get it's value


XYZ = IE.Document.Formname .VarName.Value

(this seems to work with the text values, have not tried stuffing yet
though)


but with the checkboxes, I am not sure.
Here is how they are coded.

First the form is POST being defined as
<form name="BTSFeatureBean"
method="POST" action="/bts/jsp/btsfeat.do">


Here are how the checkboxes are defined;



<div align="left">
<input type="checkbox" name="feature" value="acr" CHECKED >
</div>

Here is the code I have, the LOOP does change ALL of the check boxes, but I
need to figure out how to control on an individual basis



Sub test()
Set myie = GetIE(webpageUrl)
If Not myie Is Nothing Then
MsgBox myie
With myie

.Visible = 1
'.BTSFeatureBean.ac.Checked


End With

Set checks = myie.Document.getElementsByTagName("input")
For Each check In checks
MsgBox check.Name
MsgBox check.Value
If check.Type = "checkbox" Then check.Checked = True

Next
tr = myie.Document.BTSFeatureBean.checks(47).Value

'MsgBox = myie.Document.BTSFeatureBean.checks[2]


MsgBox myie.Document.BTSFeatureBean.acr.Checked
myie.Document.BTSFeatureBean.Click

MsgBox myie.Document.BTSFeatureBean.subtn.Value
q = myie.Document.BTSFeatureBean.acr.Value

s = VarType(q)
MsgBox myie.Document.BTSFeatureBean.ac.Value

'Dim Doc As HTMLDocument
'Set Doc = IE.document

'With Doc.getElementsByName("checkBoxList(OrderStatus)")
'Item(0).Checked = True 'Entered
'End With

End If
End Sub




I am also having problems with "CLICKING" the buttons
Here is a sample of how they are being called


<div align="center">
<input type="button" value="Apply" class="button"
onClick="return chkReqFields('2');">
<input type="hidden" name="action" value="CHANGE">


</div>



Again, much thanks!
Bruce

mctabish
07-09-2009, 02:48 PM
I have figured out how to TOGGLE, but not how to get the current value.
Here is how I can toggle the check boxes



myie.Document.BTSFeatureBean.feature(acr).Click


Any ideas how to get the value?

Thanks
Bruce