GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
HTML::DOM::Element::Form(3) User Contributed Perl Documentation HTML::DOM::Element::Form(3)
 

HTML::DOM::Element::Form - A Perl class for representing 'form' elements in an HTML DOM tree

Version 0.058

  use HTML::DOM;
  $doc = HTML::DOM->new;
  $elem = $doc->createElement('form');
  $elem->method('GET') # set attribute
  $elem->method;       # get attribute
  $elem->enctype;
  $elem->tagName;
  # etc

This class implements 'form' elements in an HTML::DOM tree. It implements the HTMLFormElement DOM interface and inherits from HTML::DOM::Element (q.v.).
A form object can be used as a hash or an array, to access its input fields, so "$form->[0]" and "$form->{name}" are shorthand for "$form->elements->[0]" and "$form->elements->{name}", respectively.
This class also tries to mimic HTML::Form, but is not entirely compatible with its interface. See "WWW::Mechanize COMPATIBILITY", below.

In addition to those inherited from HTML::DOM::Element and HTML::DOM::Node, this class implements the following DOM methods:
elements
Returns a collection (HTML::DOM::Collection::Elements object) in scalar context, or a list in list context, of all the input fields this form contains. This differs slightly from the "inputs" method (part of the HTML::Form interface) in that it includes 'button' elements, whereas "inputs" does not (though it does include 'input' elements with 'button' for the type).
length
Same as "$form->elements->length".
name
acceptCharset
action
enctype
method
target
Each of these returns the corresponding HTML attribute ("acceptCharset" corresponds to the 'accept-charset' attribute). If you pass an argument, it will become the new value of the attribute, and the old value will be returned.
submit
This triggers the form's 'submit' event, calling the default event handler (see "EVENT HANDLING" in HTML::DOM). It is up to the default event handler to take any further action. The form's "make_request" method may come in handy.
This method is actually just short for $form->trigger_event('submit'). (See HTML::DOM::EventTarget.)
reset
This triggers the form's 'reset' event.
trigger_event
This class overrides the superclasses' method to trigger the default event handler for form submissions, when the submit event occurs, and reset the form when a reset event occurs.

In order to work with WWW::Mechanize, this module mimics, and is partly compatible with the interface of, HTML::Form.
HTML::Form's class methods do not apply. If you call "HTML::DOM::Element::Form->parse", for instance, you'll just get an error, because it doesn't exist.
The "dump" and "try_others" methods do not exist either.
The "click" method behaves differently from HTML::Form's, in that it does not call "make_request", but triggers a 'click' event if there is a button to click, or a 'submit' event otherwise.
The "method", "action", "enctype", "attr", "inputs", "find_input", "value", "param", "make_request" and "form" methods should work as expected.

HTML::DOM
HTML::DOM::Element
HTML::DOM::Collection::Elements
HTML::Form
2018-02-02 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.