Trying to get dropdown box that then open up the next dropdown. there are 3 in all

Trying to get dropdown box that then open up the next dropdown. there are 3 in all


<div class="col-md-12">
<span class="text-danger">*</span> Birthplace:
</div>
<div class="col-md-4">
<div class="form-group">
<div class="col-md-12">
<select class="form-control" data-val="true" data-val-number="The field Region must be a number." data-val-required="Please select Region" id="BRegionId" name="BRegionId">
<option value="">Select Region</option>
<option value="1">Region I - Ilocos</option>
<option value="2">Region II - Cagayan Valley</option>
<option value="3">Region III - Central Luzon</option>
<option value="4">Region IVA - CALABARZON</option>
</select>
<span class="field-validation-valid text-danger" data-valmsg-for="BRegionId" data-valmsg-replace="true"></span>
</div>
</div>
</div>

<div class="col-md-4">
<div class="form-group">
<div class="col-md-12">
<select class="form-control" data-val="true" data-val-number="The field Province must be a number." data-val-required="Please select Province / District" id="BProvinceId" name="BProvinceId">
<option value="">--------</option>
</select>
<span class="field-validation-valid text-danger" data-valmsg-for="BProvinceId" data-valmsg-replace="true"></span>
</div>
</div>
</div>

<div class="col-md-4">
<div class="form-group">
<div class="col-md-12">
<select class="form-control" data-val="true" data-val-number="The field City/Municipality must be a number." data-val-required="Please select City/Municipality" id="BCityId" name="BCityId">
<option value="">--------</option>
</select>
<span class="field-validation-valid text-danger" data-valmsg-for="BCityId" data-valmsg-replace="true"></span>
</div>
</div>
</div>

<div class="col-md-4">
<div class="form-group">
<div class="col-md-12">



I am new to this VBA (Access 2007) to HTML (IE) side of things (it is not my profession but say hobby) and I am making most things work from reading through different posts, but one thing has got me stuck for numerous days.
The above code is part of an online form of which I have filled all the boxes except for three (3) dropdown boxes of which you need to FIRST dropdown and select the first selection which then changes the SECOND dropdown (or makes it True), then you make second selection which then changes the THIRD dropdown (or makes it TRUE), then you make the final selection.



I can focus on the first dropdown, fill in the first dropdown with data but I have tried most different 'click' arrangements I can find online and nothing seems to work.



By my understanding:



My code I am playing around with is below with a lot of the tries taken out.


Dim HTMLDoc As HTMLDocument
Dim MyBrowser As InternetExplorer
Dim MyHTML_Element As IHTMLElement
Dim MyURL As String

On Error GoTo Err_Clear
MyURL = "http://t2mis.tesda.gov.ph/Registration/Register"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.Navigate MyURL
MyBrowser.Visible = True

Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.Document
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If

Do
DoEvents
Loop Until IE.readyState = 4

HTMLDoc.All.Family_name.Value = "LASTNAME"
HTMLDoc.All.First_name.Value = "FIRSTNAME"
HTMLDoc.All.Middle_name.Value = "MIDDLENAME"

' SOME OF THE DIFFERENT CODES i HAVE BEEN TRYING TO OPEN AND SELECT
DROPDOWN
'Set oSELECT = MyBrowser.Document.getElementById("BRegionId")
'oSELECT.Focus
'oSELECT.selectedIndex = 11
'oSELECT.FireEvent "onchange"

'From page "
$('BRegionId').val('1').trigger('click').selectric('refresh');
loadquote('1');"
'HTMLDoc.getElementById("BRegionId").selectedIndex = 1
'HTMLDoc.parentWindow.execScript "loadquote('1')"

'HTMLDoc.getElementsByClassName("form-control")(1).Click
'Set element = HTMLDoc.getElementById("BRegionId")
'HTMLDoc.getElementById("BRegionId").Click
'element.Value = "11"
'HTMLDoc.getElementById("BRegionId").Click

'Set objButton = HTMLDoc.getElementById("BRegionId")
'objButton.Focus
'objButton.Click
'HTMLDoc.getElementById("BRegionId").Value = "11"

'HTMLDoc.All.RegionId.Value = "11" <<< THIS CAN FILL IN THE DROPDOWN
BUT NO REACTION






Have corrected up the code as you have suggested - Thank you :)

– IanT
May 9 '18 at 0:28






I am still have problems with my drop down box issue. Everything else is working fine. Maybe can someone guide me to just one challenge. To make the selected dropdown box just drop down only. That is imitate me just clicking on the down arrow. Not selecting anything, just dropping the box down so I can see the selections available to me. Maybe I can move forward from that if it can be achieved?

– IanT
May 10 '18 at 10:31




0



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)