Contents - Index - Top


RequestElementValueByName

Interface AntViewDocument

 

Type: Method

Parameters: String Name

Returns: nothing

 

 

Request the contents of the value attribute for the html element identified by Name.

Name is case sensitive.

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.

 

As the request is run asynchronously, the requested value is returned in the OnRequestElementValueByName event.

 

Note that multiple elements can match the name passed. If this is the case then only the data of the first element that matches the name will be retrieved.

 

 

Example:

 

Suppose we have the following html:

    <form id="login" class="login" action="thankYou.html">

        <div class="loginName">

            <label for="username">UserName</label>

            <input type="text" name="username" placeholder="User Name" required />

        </div>

 

        <div class="loginPassword">

            <label for="password">Password</label>

            <input type="password" name="password" placeholder="Password" required />

        </div>

 

        <div class="loginBtn">

            <button id="submit" type="submit" name="submit">Login</button>

        </div>

    </form>

 

 

Then in DataFlex run:

 

   Object oReadFormButton is a Button

     Set Location to 199 92

     Set Label to "Read Form"

     Set peAnchors to anBottomLeft

 

     Procedure OnClick

       Send ConnectBrowser to oDocument

       Send ComRequestElementValueByName of oDocument "username"

       Send ComRequestElementValueByName of oDocument "password"

     End_Procedure

   

   End_Object

 

or in VB6:

 

Example in VB6:

Private Sub ReadFormButton_Click()

  Document.RequestElementValueByName "username"

  Document.RequestElementValueByName "password"

End Sub

 

Private Sub Document_OnRequestElementValueByName(ByVal Name As String, ByVal Value As String, ByVal Error As Long)

  Debug.Print ("Name '" & Name & "' = " & Value)

End Sub

 

 

There's also a synchronous alternative RequestElementValueByNameSync that wraps this method and the event into one call.

 

See also: ElementValueByName

 

Example: 

Fill Form Example

 


AntView - The MS Edge WebView2 ActiveX control Date last changed: 09/25/2024