The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Embperl::Form::Control - Base class for controls inside an Embperl Form

SYNOPSIS

Do not use directly, instead derive a class

DESCRIPTION

This class is not used directly, it is used as a base class for all controls inside an Embperl Form. It provides a set of methods that could be overwritten to customize the behaviour of your controls.

METHODS

new

Create a new control

init

Init the new control

noframe

Do not draw frame border if this is the only control

is_disabled

Do not display this control at all.

is_readonly

Could value of this control be changed ?

=h�ad2 prepare_fdat

Is called when the form is submitted back. Can be used to convert the value that the user has entered in the form to the format that is used internally. E.g. convert a human readable date/time format, which might be different depending on the locale, to the interal datetime format.

init_data

Is called when the control should be displayed. Can be used to convert the internal format of the value to the format that the user should see in the input control. E.g. convert internal datetime representation to a human readable date/time format, which might be different depending on the locale.

This method is not called if the control is readonly.

get_display_text

Returns the value that should be displayed inside a readonly control or inside a table. This is similar to init_data, but for readonly controls.

This method is only called if the control is readonly.

get_sort_value

returns the value that should be used to sort

get_id_from_value

returns the id that is associated with value if any

init_markup

This method is called instaed of show, if only the control data is sent to the browser and not the whole markup. This can be used to insert dynamic markup.

label_text

Returns the text of the label

show

Output the control

get_on_show_code

Returns JavaScript code that should be executed when the form becomes visible

get_active_id

Get the id of the value which is currently active

form

Return the form object of this control

show_sub_begin

Output begin of sub form

show_sub_end

Output end of sub form

show_label

Output the label of the control

show_label_icon

Output the icon after the label

show_label_cell

Output the table cell in which the label will be displayed

Must return the columns it spans (default: 1)

show_control

Output the control itself

show_control_readonly

Output the control itself as readonly

show_control_addons

output additional things after the control

show_control_cell

Output the table cell in which the control will be displayed

Gets the x position as argument

PARAMETERS

name

Specifies the name of the control

text

Will be used as label for the control, if not given 'name' is used as default.

Normally the the name and text parameters are processed by the method convert_label of the Embperl::Form object. This method can be overwritten, to allow translation etc.

If the parameter showtext is given a true value, convert_label is not called and the text is displayed as it is.

showtext

Display label without passing it through convert_label. See text.

labelnowrap

If set, the text label will not be line wrapped.

labelclass

If set, will be used as additional CSS classes for the label text cell.

readonly

If set, displays a readonly version of the control.

disable

If set, the control will not be displayed at all.

newline

If set to 1, forces a new line before the control. If set to -1, forces a new line after the control.

width

Gives the widths of the control. The value is 1/width of the the whole width of the form. So if you want to have four controls in one line set width to 4. The default value is 2.

width_percent

With this parameter you can also specify the width of the control in percent. This parameter take precedence over width

default

Default value of the control

imagedir

Basepath where to find images, in case the control uses images. Default value is /images

trigger

When set will trigger state changes of other controls. See "state".

state

Can be used to hide/show disable/enable the control trigger by other controls.

Checkbox define the following states:

  • <id-of-checkbox>-show

    Show control if checkbox checked

  • <id-of-checkbox>-hide

    Hide control if checkbox checked

  • <id-of-checkbox>-enable

    Enable control if checkbox checked

  • <id-of-checkbox>-disable

    Disable control if checkbox checked

AUTHOR

G. Richter (richter at embperl dot org)

SEE ALSO

perl(1), Embperl, Embperl::Form

1 POD Error

The following errors were encountered while parsing the POD:

Around line 735:

Non-ASCII character seen before =encoding in '=h�ad2'. Assuming UTF-8