
This interface specifies that the contained controls take part in a form.
When programming the form, all control-like elements are added to the form as named items. In addition, these items are exposed through the IHTMLFormElement::item method.
When the focus is on a control in a form, pressing the ESC key once causes the value of the control to revert back to the last value, and pressing the ESC key again resets the form.
If one and only one text box is on a form, pressing ENTER fires the onsubmit event. If the form has a submit button, the button appears with a dark border, indicating that pressing ENTER submits the form.
This element is a block element.
IHTMLFormElement Methods
HRESULT put_action(
BSTR v
);
Sets the address to be used to carry out the action of the form. If none is specified, the base URL of the document is used.
The way the data is submitted depends upon the value of the method and encoding properties.
See also get_action
HRESULT get_action(
BSTR *p
);
Retrieves the address to be used to carry out the action of the form. If none is specified, the base URL of the document is used.
The way the data is submitted depends upon the value of the method and encoding properties.
See also put_action
HRESULT put_dir(
BSTR v
);
Sets the form's direction property. The direction represents the direction of the text on the form.
| "leftToRight" | The direction is from left to right. |
| "rightToLeft" | The direction is from right to left. |
See also get_dir
HRESULT get_dir(
BSTR *p
);
Retrieves the direction value for the form. The direction represents the direction of the text on the form.
| "leftToRight" | The direction is from left to right. |
| "rightToLeft" | The direction is from right to left. |
See also put_dir
HRESULT put_encoding(
BSTR v
);
Sets the mime encoding for the form. This property corresponds to the HTML ENCTYPE= attribute.
See also get_encoding
HRESULT get_encoding(
BSTR *p
);
Retrieves the mime-encoding for the form. This property corresponds to the HTML ENCTYPE= attribute.
See also put_encoding
HRESULT put_method(
BSTR v
);
Specifies how the form data should be sent to the server, either as GET or POST.
| get | Append the arguments to the action URL and open it as if it were an anchor. |
| post | Send the data through an HTTP POST transaction. |
See also get_method
HRESULT get_method(
BSTR *p
);
Retrieves how the form data should be sent to the server, either as GET or POST.
| get | Append the arguments to the action URL and open it as if it were an anchor. |
| post | Send the data through an HTTP POST transaction. |
See also put_method
HRESULT get_elements(
IDispatch **p
);
Retrieves an interface pointer to a zero-based collection of the elements in the form. The pointer provides access to the properties and methods of the elements. The order of the elements in the collection is determined by the HTML source.
HRESULT put_target(
BSTR v
);
Sets the window or frame to target the contents at.
| _blank | Specifies to load the link into a new blank window. This window is not named. |
| _parent | Specifies to load the link into the immediate parent of the document the link is in. |
| _self | Specifies to load the link into the same window the link was clicked in. |
| _top | Specifies to load the link into the full body of the window. |
If there is no frame or window that matches the specified target, a new window is opened for the link.
The default value for the target depends upon the URL and site. If the user does not leave the site, the default is _self, but if the user exits to a new site, the default is _top.
See also get_target
HRESULT get_target(
BSTR *p
);
Retrieves the window or frame to target the contents at.
| _blank | Specifies to load the link into a new blank window. This window is not named. |
| _parent | Specifies to load the link into the immediate parent of the document the link is in. |
| _self | Specifies to load the link into the same window the link was clicked in. |
| _top | Specifies to load the link into the full body of the window. |
If there is no frame or window that matches the specified target, a new window is opened for the link.
The default value for the target depends upon the URL and site. If the user does not leave the site, the default is _self, but if the user exits to a new site, the default is _top.
See also put_target
HRESULT put_name(
BSTR v
);
Sets the name of the control, bookmark, or application.
The name is used to bind the value of the control when submitting a form. The NAME is not the value that is displayed for the button, reset, and submit objects. Submitting the form submits the internally stored value, not the one displayed.
JScript allows the name to be changed at run time. This does change the name in the programming model, in the collection of elements, but does change the name used for submitting elements.
See also get_name
HRESULT get_name(
BSTR *p
);
Retrieves the name of the control, bookmark, or application.
The name is used to bind the value of the control when submitting a form. The NAME is not the value that is displayed for the button, reset, and submit objects. Submitting the form submits the internally stored value, not the one displayed.
JScript allows the name to be changed at run time. This does not change the name in the programming model, in the collection of elements, but does change the name used for submitting elements.
See also put_name
HRESULT put_onsubmit(
VARIANT v
);
Sets the inline script associated with the onsubmit event for a FORM element. A submit event occurs when a user submits a form (clicks a Submit button).
See also get_onsubmit
HRESULT get_onsubmit(
VARIANT *p
);
Retrieves the inline script associated with the onsubmit event for a FORM element. A submit event occurs when a user submits a form (clicks a Submit button).
See also put_onsubmit
HRESULT put_onreset(
VARIANT v
);
Sets the inline script associated with the onreset event for a FORM element. A reset event occurs when a user resets a form (clicks a Reset button).
See also get_onreset
HRESULT get_onreset(
VARIANT *p
);
Retrieves the inline script associated with the onreset event for a FORM element. A reset event occurs when a user resets a form (clicks a Reset button).
See also put_onreset
HRESULT submit(
void
);
Submits the form and fires the onsubmit event.
HRESULT reset(
void
);
Simulates a mouse click on a reset button for the calling form.
HRESULT put_length(
long v
);
Sets the number of elements in a collection.
This property is read-write on the areas and the options collection for image maps and select boxes, respectively. This allows a developer to shrink the collection.
See also get_length
HRESULT get_length(
long *p
);
Retrieves the number of elements in a collection.
This property is read-write on the areas and the options collection for image maps and select boxes, respectively. This allows a developer to shrink the collection.
See also put_length
HRESULT get__newEnum(
IUnknown **p
);
Retrieves an enumerator interface which can be used to iterate through the form element collection.
HRESULT item(
VARIANT name,
VARIANT index,
IDispatch **pdisp
);
Retrieves an element or a collection from the given collection. The index determines which action to take.
HRESULT tags(
VARIANT tagName,
IDispatch **pdisp
);
Retrieves a collection of all elements in the given collection that have the given HTML tag name.
This method returns an empty collection if no elements having the given name are found. Use the length property on the collection to determine the number of elements it contains.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.