HTML::DOM::Element::Input - A Perl class for representing 'input' elements in an HTML DOM tree
use HTML::DOM; $doc = HTML::DOM->new; $elem = $doc->createElement('input'); $elem->setAttribute('type' => 'text');
$elem->click(); $elem->blur(); # etc.
$elem->checked(1) # set attribute $elem->type; # get attribute $elem->tagName; # etc.
This class implements 'input' elements in an HTML::DOM tree. It implements the HTMLInputElement DOM interface and inherits from the HTML::DOM::Element manpage (q.v.).
In addition to those inherited from HTML::DOM::Element and its superclasses, this class implements the following DOM methods:
Each of these returns the corresponding HTML attribute (the 'value' and
'checked' attributes
in the case of defaultValue and defaultChecked, respectively). If you
pass an
argument, it will become the new value of the attribute, and the old value
will be returned.
Returns the form containing this input element.
These methods allow one to change the state of the input field. The change
is not reflected in the HTML attributes. These will be called with the
values of defaultValue and
defaultChecked when the form's reset method is invoked.
The value method behaves differently if the calling package is HTML::Form, HTML::Form::Input or
WWW::Mechanize. For checkboxes, the return value will be undef if the box
is not checked.
With an undef argument the box will be unchecked. If an argument is given
that is the same as the 'value' attribute, the box will be checked. If any
other argument is passed, it will die. If the 'type' attribute is 'button' or 'reset,' value will simply return.
Each of these triggers the corresponding event. The click method can
take
three arguments, all optional: (0) the form, (1) the x-coordinate where the
mouse supposedly clicked and (2) the y-coordinate.
In addition, the following methods are provided for compatibility with the WWW::Mechanize manpage:
This returns an empty list for most input elements, but for checkboxes it
returns (undef, $value).
Returns a list of two items: (0) the name of the field and (1) the value.
An alias for value
This get/sets the filename reported to the server during file upload.
This attribute defaults to the value reported by the file() method.
Returns an empty list (for now).
This get/sets the file content provided to the server during file upload. This method can be used if you do not want the content to be read from an actual file.
the HTML::DOM::Element manpage