sub add_to_form
{
my($self, $form) = @_;
push(@{$form->{'inputs'}}, $self);
$self;
}
sub strict {
my $self = shift;
my $old = $self->{strict};
if (@_) {
$self->{strict} = shift;
}
$old;
}
sub fixup {}
=item $input->type
Returns the type of this input. The type is one of the following
strings: "text", "password", "hidden", "textarea", "file", "image", "submit",
"radio", "checkbox" or "option".
=cut
sub type
{
shift->{type};
}
=item $name = $input->name
=item $input->name( $new_name )
This method can be used to get/set the current name of the input.
=item $value = $input->value
=item $input->value( $new_value )
This method can be used to get/set the current value of an
input.
If strict is enabled and the input only can take an enumerated list of values,
then it is an error to try to set it to something else and the method will
croak if you try.
You will also be able to set the value of read-only inputs, but a
warning will be generated if running under C<perl -w>.
=cut
sub name
{
my $self = shift;
my $old = $self->{name};
$self->{name} = shift if @_;
$old;
}
sub value
{
my $self = shift;
my $old = $self->{value};
$self->{value} = shift if @_;
$old;
}
=item $input->possible_values
Returns a list of all values that an input can take. For inputs that
do not have discrete values, this returns an empty list.
=cut
sub possible_values
{
return;
}
=item $input->other_possible_values
Returns a list of all values not tried yet.
=cut
sub other_possible_values
{
return;
}
=item $input->value_names
For some inputs the values can have names that are different from the
values themselves. The number of names returned by this method will
match the number of values reported by $input->possible_values.
When setting values using the value() method it is also possible to
=9= |