element" />

Solstice::View::FormInput::TextInput - A view of an html <input type="text"> element


Solstice documentation Contained in the Solstice distribution.

Index


Code Index:

NAME

Top

Solstice::View::FormInput::TextInput - A view of an html <input type="text"> element

SYNOPSIS

Top

    use Solstice::View::FormInput::TextInput;

    my $content = 'A string containing <i>content</i>.';

    my $view = Solstice::View::FormInput::TextInput->new($content);
    $view->setName('mytextbox');
    $view->setWidth('90%');  # a percentage or an integer representing pixels
    $view->setIsResizable(1);

DESCRIPTION

Top

Superclass

Solstice::View::FormInput (Solstice::View::FormInput)

Export

No symbols exported.

Methods

setWidth($int)
getWidth()
setCharLimit($int)
getCharLimit()
generateParams()

Modules Used

Solstice::View.

AUTHOR

Top

Solstice Group, <catalyst@u.washington.edu>

VERSION

Top

$Revision: 63 $

SEE ALSO

Top

perl.

COPYRIGHT

Top


Solstice documentation Contained in the Solstice distribution.
package Solstice::View::FormInput::TextInput;

# $Id: TextInput.pm 63 2006-06-19 22:51:42Z jlaney $

use 5.006_000;
use strict;
use warnings;

use base qw(Solstice::View::FormInput);

use constant TRUE  => 1;
use constant FALSE => 0;
use constant WIDTH => '100%';

our $template = 'form_input/textinput.html';

our ($VERSION) = ('$Revision: 63 $' =~ /^\$Revision:\s*([\d.]*)/);

sub new {
    my $class = shift;
    my $self = $class->SUPER::new(@_);

    $self->_setTemplatePath('templates');

    return $self;
}

sub setWidth {
    my $self = shift;
    $self->{'_width'} = shift;
}

sub getWidth {
    my $self = shift;
    return $self->{'_width'};
}

sub setCharLimit {
    my $self = shift;
    $self->{'_char_limit'} = shift;
}

sub getCharLimit {
    my $self = shift;
    return $self->{'_char_limit'};
}

sub generateParams {
    my $self = shift;

    my $width = $self->getWidth() || WIDTH;
    
    $self->setParam('name', $self->getName());    
    $self->setParam('width', ($width =~ /^\d+%$/) ? $width : $width.'px');
    $self->setParam('char_limit', $self->getCharLimit()); 
    $self->setParam('content', $self->getModel());
    $self->setParam('error', '');
    
    return TRUE;
}

1;

__END__