Skip to content Skip to sidebar Skip to footer

How Can I Force An AngluarJS Form To Realize Required Fields Have Been Filled Through DOM Manipulation (no User Input)?

I've written an Excel VBA macro to paste some data into an AngularJS form -- it opens an Internet Explorer (11) window, navigates to the page containing the form, and crawls the do

Solution 1:

Have you solved this problem Karim or found any solution? I recently had a project of mine, with the same problem. Try to find the tag with ng-submit something like what I have 'ng-submit"=submit($event)"'. I referenced the form element and used .submit. In your case, try this:

Set HTMLFormEl = HTML.getElementById("accountNameValue")

HTMLFormEl.Submit

The 'submit' was the one that solved my problem. Let me know if this works for you.

Not a VBA nor AngularJS expert but I noticed that AngularJS has nothing to do in treating the required fields as if they were still blank. Just need to find the correct event to trigger. Just my opinion.


Solution 2:

Don't know is my answer is actual or not, but i had the same problem, and i found a solution using Application.SendKeys. The function filling out the form looks like this

Function inputWrite(ByVal str As String, inputEl As Object, ByVal hwnd As LongLong) As Boolean
TryAgain_inputWrite:
    strSub = Left(str, Len(str) - 1)
    strKey = Right(str, 1)

    inputEl.Focus
    inputEl.Value = strSub
    setToFore hwnd
    Application.SendKeys strKey

    Application.Wait DateAdd("s", 1, Now)

    If (inputEl.Value = str) Then
        inputWrite = True
    Else
        GoTo TryAgain_inputWrite
    End If
End Function

setToFore is just a function to always keep the Internet Explorer on top of other applications, so the send key won't miss.


Post a Comment for "How Can I Force An AngluarJS Form To Realize Required Fields Have Been Filled Through DOM Manipulation (no User Input)?"