RequestElementValueById
Interface AntViewDocument
Type: Method
Parameters: String Id
Returns: nothing
Request the contents of the value attribute for the html element identified by Id.
Note that the id is case sensitive and must match the case of the html element.
Not all of the html elements normally have a value attribute.
The most common element with a value attribute is the input element as used in html forms.
<form id="login" class="login" action="thankYou.html">
<div class="loginName">
<label for="username">UserName</label>
<input type="text" id="username" placeholder="User Name" required />
</div>
<div class="loginPassword">
<label for="password">Password</label>
<input type="password" id="password" placeholder="Password" required />
</div>
<div class="loginBtn">
<button id="submit" type="submit" name="submit">Login</button>
</div>
</form>
Example in VB6:
Private Sub ReadFormButton_Click()
Document.RequestElementValueById "username"
Document.RequestElementValueById "password"
End Sub
Private Sub Document_OnRequestElementValueById(ByVal Id As String, ByVal Value As String, ByVal Error As Long)
Debug.Print ("Id '" & Id & "' = " & Value)
End Sub
As the request is run asynchronously, the requested value is returned in the OnRequestElementValueById event.
There's also a synchronous alternative RequestElementValueByIdSync that wraps the above into one call.
See also: ElementValueById
Example:
AntView - The MS Edge WebView2 ActiveX control Date last changed: 09/30/2024