action Property

Microsoft FrontPage Visual Basic

Show All Show All

action Property

ShowAs it applies to the SearchInfo object.

Sets or returns a fpSearchAction that represents the type of search to perform.

fpSearchAction can be one of the following fpSearchAction constants.

fpSearchFindTagSearches for matching text in the HTML tags.
fpSearchFindTextSearches for matching text in the document.
fpSearchReplaceAllTextSearches and replaces all matching text in the document.
fpSearchReplaceTextReplaces the text and searches for the next occurence.

expression.action

expression    Required. An expression that returns a SearchInfo object.

ShowAs it applies to all other objects in the Applies To list.

Sets or returns a String that represents the URL where the content of a form is sent for processing. This URL could represent a database, an e-mail address, or an ASP page.

expression.action

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

The action property sets the action attribute for the FORM element. The way the form submits data depends on the value of the method and encoding properties.

Example

ShowAs it applies to the SearchInfo object.

The following example selects the next occurence of the P element, if one is found in the active document.

      Dim objSearch As SearchInfo
Dim blnFound As Boolean
Dim objRange As IHTMLTxtRange

Set objSearch = Application.CreateSearchInfo
objSearch.Find = "p"
objSearch.Action = fpSearchFindTag

Set objRange = Application.ActiveDocument.selection.createRange
blnFound = Application.ActiveDocument.Find(objSearch, Nothing, objRange)
If blnFound = True Then objRange.Select
    

ShowAs it applies to the FPHTMLFormElement object.

The following example sets the URL for the action, method, and encoding properties for the specified form.

Sub SetFormAction(objForm As FPHTMLFormElement, _
        strAction As String, strMethod As String, _
        strEncoding As String)
    
    With objForm
        .action = strAction
        .method = strMethod
        .encoding = strEncoding
    End With
End Sub

Use the following subroutine to call the preceding subroutine.

Sub CallSetFormAction()
    Dim objForm As FPHTMLFormElement
    
    ActiveDocument.body.insertAdjacentHTML "beforeend", _
        "<form id=""newform""></form>"
    Set objForm = ActiveDocument.all.tags("form").Item("newform")

    Call SetFormAction(objForm, "mailto: [email protected]", _
        "post", "application/x-www-form-urlencoded")
End Sub