form Property

Microsoft FrontPage Visual Basic

form Property

Returns an IHTMLFormElement object that represents the form to which an element belongs.

expression.form

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

Example

The following example replaces the text within the active document with a form containing a text box and two buttons. It then sets the value of the method property of the parent FORM element to "post."

    Sub CreateForm()
    Dim objTextbox As FPHTMLTextAreaElement

    ActiveDocument.body.innerHTML = "<form id=""textform"">" & vbCrLf & _
        "<textarea rows=""10"" cols=""40"" name=""textbox"" id=""textbox"">" & _
        "</textarea><br>" & vbCrLf & "<input type=""submit"" " & _
        "value=""Submit"" name=""submit"" id=""submit"">" & vbCrLf & _
        "<input type=""reset"" value=""Reset"" name=""reset"" id=""reset"">" & _
        vbCrLf & "</form>"

    Set objTextbox = ActiveDocument.body.all.tags("textarea").Item("textbox")

    objTextbox.form.method = "post"
End Sub