Hi everyone,
I'm using VBA to populate a web form and 99% of it is working just fine.
I have one problem, though, when trying to populate a field that depends on a previous one. This is an internal (corporate) web form so I can't use a real example, but here is an exercise:
Imagine I want to populate two fields: one being the "Month" and the other being the "day". No matter the data I enter in the Month and although returning no error, the day field is always left blank.
I'm afraid this is somehow related to some kind of validation (as you know, a standard use of the form would't allow me to select February and then have have the day 31st available...). I even tried thing like sending a tabkey between both, just in case, but it still wont work.
Here's the code I'm using (fictional web site address):
Here's what I think is the needed HTML and Javascript (I'm very limited regarding those) and sorry for the pictures but the forum is blocking e from publishing this code...
HTML:
Java:
Thank you.
I'm using VBA to populate a web form and 99% of it is working just fine.
I have one problem, though, when trying to populate a field that depends on a previous one. This is an internal (corporate) web form so I can't use a real example, but here is an exercise:
Imagine I want to populate two fields: one being the "Month" and the other being the "day". No matter the data I enter in the Month and although returning no error, the day field is always left blank.
I'm afraid this is somehow related to some kind of validation (as you know, a standard use of the form would't allow me to select February and then have have the day 31st available...). I even tried thing like sending a tabkey between both, just in case, but it still wont work.
Here's the code I'm using (fictional web site address):
Code:
<code>Sub webform()
Dim IE As Object
Set IE = New InternetExplorerMedium
IE.Visible = True
IE.Navigate "http://www.fakewebsite.com"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
IE.document.getElementById("month").Value = "April"
IE.document.getElementById("day").Value = "21"
End Sub</code>
Here's what I think is the needed HTML and Javascript (I'm very limited regarding those) and sorry for the pictures but the forum is blocking e from publishing this code...
HTML:
Java:
Thank you.