- Mozilla::Mechanize::Form->new($form_node, $moz);
- $form->method( [$new_method] )
- $form->action( [$new_action] )
- $form->enctype( [$new_enctype] )
- $form->attr( $name[, $new_value] )
- $form->find_input( $name[, $type[, $index]] )
- $form->value( $name[, $new_value] )
- $self->_radio_group( $name )
- COPYRIGHT AND LICENSE
Mozilla::Mechanize::Form - Mimic HTML::Form
Read the code for now
Mozilla::Mechanize::Form object is a thin wrapper around Mozilla::DOM::HTMLFormElement.
Initialize a new object. $form_node is a Mozilla::DOM::HTMLFormElement (or a node that can be QueryInterfaced to one). $moz is a Mozilla::Mechanize object. (This latter is a hack for `submit' and `reset', so that new pages can load in the browser. The GUI has to be able to enter its main loop. If you don't plan to use those methods, you don't have to pass it in.)
$form->method( [$new_method] )
Get/Set the method used to submit the from (i.e. GET or POST).
$form->action( [$new_action] )
Get/Set the action for submitting the form.
$form->enctype( [$new_enctype] )
Get/Set the enctype of the form.
Return the name of this form.
$form->attr( $name[, $new_value] )
Get/Set any of the attributes from the FORM-tag (acceptcharset, action, enctype, method, name, target (returns undef if $name isn't one of these)).
Returns a list of Mozilla::Mechanize::Input objects. In scalar context it will return the number of inputs.
XXX: I'm confused about how radio buttons are implemented. Win32::IE::Mechanize only pushes on the first one for some reason. (I push them all for now.)
$form->find_input( $name[, $type[, $index]] )
This method is used to locate specific inputs within the form. All inputs that match the arguments given are returned. In scalar context only the first is returned, or
undef if none match.
If $name is specified, then the input must have the indicated name.
If $type is specified, then the input must have the specified type. The following type names are used: "text", "password", "hidden", "textarea", "file", "image", "submit", "radio", "checkbox", and "option". (and "button" and "select"?)
The $index is the sequence number of the input matched where 1 is the first. If combined with $name and/or $type then it select the nth input with the given name and/or type.
(This method is ported from HTML::Form)
$form->value( $name[, $new_value] )
Get/Set the value for the input-control with specified name.
Submit this form. (Note: does not trigger onSubmit.)
Reset inputs to their default values. (Note: I added this method, though it wasn't in WWW::Mechanize.)
$self->_radio_group( $name )
Returns a list of Mozilla::DOM::HTMLInputElement objects with name eq $name. (Intended for use with Input.pm's radio_value method.)
COPYRIGHT AND LICENSE
Copyright 2005,2009 Scott Lanning <firstname.lastname@example.org>. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.