adding the new form system
This commit is contained in:
parent
fe0d968d87
commit
7d95169b38
26 changed files with 2160 additions and 1073 deletions
100
lib/WebGUI/Form/textarea.pm
Normal file
100
lib/WebGUI/Form/textarea.pm
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
package WebGUI::Form::textarea;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2005 Plain Black Corporation.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Form::Control';
|
||||
use WebGUI::Session;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Form::textarea
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Creates a text area form field.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
This is a subclass of WebGUI::Form::Control.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
The following methods are specifically available from this class. Check the superclass for additional methods.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( [ additionalTerms ] )
|
||||
|
||||
See the super class for additional details.
|
||||
|
||||
=head3 additionalTerms
|
||||
|
||||
The following additional parameters have been added via this sub class.
|
||||
|
||||
=head4 rows
|
||||
|
||||
The number of rows (in characters) tall the box should be. Defaults to the setting textAreaRows or 5 if that's not specified.
|
||||
|
||||
=head4 columns
|
||||
|
||||
The number of columns (in characters) wide the box should be. Defaults to the setting textAreaCols or 50 if that's not specified.
|
||||
|
||||
=head4 wrap
|
||||
|
||||
The style of wrapping this form should use. Defaults to "virtual". Other possible values are "off" and "physical".
|
||||
|
||||
=head
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $definition = shift || [];
|
||||
push(@{$definition}, {
|
||||
rows=>{
|
||||
defaultValue=> $session{setting}{textAreaRows} || 5
|
||||
},
|
||||
columns=>{
|
||||
defaultValue=> $session{setting}{textAreaCols} || 50
|
||||
},
|
||||
wrap=>{
|
||||
defaultValue=>"virtual"
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 toHtml ( )
|
||||
|
||||
Renders an input tag of type text.
|
||||
|
||||
=cut
|
||||
|
||||
sub toHtml {
|
||||
my $self = shift;
|
||||
my $value = $self->fixMacros($self->fixTags($self->fixSpecialCharacters($self->{value})));
|
||||
return '<textarea name="'.$self->{name}.'" cols="'.$self->{columns}.'" rows="'.$self->{rows}.'" wrap="'.
|
||||
$self->{wrap}.'" '.$self->{extras}.'>'.$value.'</textarea>';
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue