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

Applies to | FPHTMLButtonElement Object | FPHTMLInputButtonElement Object | FPHTMLInputFileElement Object | FPHTMLInputHiddenElement Object | FPHTMLInputTextElement Object | FPHTMLObjectElement Object | FPHTMLOptionElement Object | FPHTMLSelectElement Object | FPHTMLTextAreaElement Object | IHTMLButtonElement Object | IHTMLInputButtonElement Object | IHTMLInputFileElement Object | IHTMLInputHiddenElement Object | IHTMLInputTextElement Object | IHTMLObjectElement Object | IHTMLOptionElement Object | IHTMLSelectElement Object | IHTMLTextAreaElement Object