NAME
Contentment::Form::Widget::Text - Textbox widget
SYNOPSIS
my $form = Contentment::Form->define(
# ...
widgets => {
username => {
name => 'username',
class => 'Text',
},
password => {
name => 'password',
class => 'Text',
},
},
# ...
);
DESCRIPTION
If you need a simple text field for something, this is your widget. It defines a simple HTML input field, which can be used to enter text or a password. The short text is validated on the server-side prior to activation.
Eventually, this widget will also support client-side validation.
The render()
method is preferred for this widget since there will never be an end tag.
The widget constructor accepts the following arguments:
- name (required)
-
This is the name of the widget. It will be used to set the name and id field for the widget.
- type (optional, defaults to "text")
-
This must be either "text" or "password". No other value is acceptable. If set to "password", the characters should be hidden while typed.
- size (optional)
-
This is the displayed length of the control.
- maxlength (optional, default is 255)
-
This is the maximum acceptable length for any entry into the control. If not given, it defaults to 255 characters. To unset the default set the maxlength to
undef
. This length will be validated. - valid_regex (optional)
-
This is the only server-side validation option currently available. This allows you to specify the regular expression any submitted value must pass before being accepted.
- valid_regex_message (optional)
-
This is the message to state if regex validation fails. Without it, the message is simply "invalid" (which isn't very descriptive).
AUTHOR
Andrew Sterling Hanenkamp, <hanenkamp@cpan.org>
LICENSE AND COPYRIGHT
Copyright 2005 Andrew Sterling Hanenkamp <hanenkamp@cpan.org>. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.