PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|Perl|site_perl|HTML|Form.pm =

page 8 of 15



    # try to find first submit button to activate
    for (@{$self->{'inputs'}}) {
        next unless $_->can("click");
        next if $name && $_->name ne $name;
	next if $_->disabled;
	return $_->click($self, @_);
    }
    Carp::croak("No clickable input with name $name") if $name;
    $self->make_request;
}


=item @kw = $form->form

Returns the current setting as a sequence of key/value pairs.  Note
that keys might be repeated, which means that some values might be
lost if the return values are assigned to a hash.

In scalar context this method returns the number of key/value pairs
generated.

=cut

sub form
{
    my $self = shift;
    map { $_->form_name_value($self) } @{$self->{'inputs'}};
}


=item $form->dump

Returns a textual representation of current state of the form.  Mainly
useful for debugging.  If called in void context, then the dump is
printed on STDERR.

=cut

sub dump
{
    my $self = shift;
    my $method  = $self->{'method'};
    my $uri     = $self->{'action'};
    my $enctype = $self->{'enctype'};
    my $dump = "$method $uri";
    $dump .= " ($enctype)"
	if $enctype ne "application/x-www-form-urlencoded";
    $dump .= " [$self->{attr}{name}]"
    	if exists $self->{attr}{name};
    $dump .= "\n";
    for ($self->inputs) {
	$dump .= "  " . $_->dump . "\n";
    }
    print STDERR $dump unless defined wantarray;
    $dump;
}


#---------------------------------------------------
package HTML::Form::Input;

=back

=head1 INPUTS

An C<HTML::Form> objects contains a sequence of I<inputs>.  References to
the inputs can be obtained with the $form->inputs or $form->find_input
methods.

Note that there is I<not> a one-to-one correspondence between input
I<objects> and E<lt>inputE<gt> I<elements> in the HTML document.  An
input object basically represents a name/value pair, so when multiple
HTML elements contribute to the same name/value pair in the submitted
form they are combined.

The input elements that are mapped one-to-one are "text", "textarea",
"password", "hidden", "file", "image", "submit" and "checkbox".  For
the "radio" and "option" inputs the story is not as simple: All
E<lt>input type="radio"E<gt> elements with the same name will
contribute to the same input radio object.  The number of radio input
objects will be the same as the number of distinct names used for the
E<lt>input type="radio"E<gt> elements.  For a E<lt>selectE<gt> element
without the C<multiple> attribute there will be one input object of
type of "option".  For a E<lt>select multipleE<gt> element there will
be one input object for each contained E<lt>optionE<gt> element.  Each
one of these option objects will have the same name.

The following methods are available for the I<input> objects:

=over 4

=cut

sub new
{
    my $class = shift;
    my $self = bless {@_}, $class;
    $self;
}

=8=

1|2|3|4|5|6|7| < PREV = PAGE 8 = NEXT > |9|10|11|12|13|14|15

UP TO ROOT | UP TO DIR | TO FIRST PAGE

Google
 


E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.00725007 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)