element" />
| Solstice documentation | Contained in the Solstice distribution. |
Solstice::View::FormInput::TextInput - A view of an html <input type="text"> element
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);
Solstice::View::FormInput (Solstice::View::FormInput)
No symbols exported.
Solstice Group, <catalyst@u.washington.edu>
$Revision: 63 $
perl.
Copyright 1998-2007 Office of Learning Technologies, University of Washington
Licensed under the Educational Community License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.opensource.org/licenses/ecl1.php
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
| 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__