[######################################################################### # Begins a new form # Param#1: Form title (if undef or '' the no title is displayed) # Param#2: Name of the form # Param#3: Script to be called upon post request #########################################################################] [* sub begin_form { ($title, $name, $script) = @_; captions_colwidth($capt_width); $form_name = $name; $valtext=''; if (defined($title) and ($title ne '')) { *]
[+ $title +]
[* } *]
[* } *] [######################################################################## # Ends a form # Param#1: Number of pixel to live as empty space before closing the # form(def=0) # Param#2: Number of pixel to live as empty space after closing the # form(def=3) ########################################################################] [* sub end_form { $height = shift; $lineh = defined($_[0]) ? shift : 3 ; *]
[* vspace($height); if ($lineh > 0) { *] [* } } *] . . . #### [# Import all functions from the controls library into script #] [* Execute ({ inputfile => '_controls_lib.epl', import => 1 }) *] [# Call functions from the library #] [* begin_form('MyFormTitle', 'my_form_name', 'action_script_name'); textinput('Username', 'user', 140, 0, 'User Name'); password('Password', 'pass', 140, 0, 'User password'); form_buttons(); end_form(); *] #### package LibControls; use Apache::Reload; use Embperl; use Exporter; use vars qw( @ISA @EXPORT_OK ); BEGIN { @ISA = qw ( Exporter ); Embperl::Execute({inputfile => $path_to_lib, import => 1, package =>__PACKAGE__}); @EXPORT_OK = qw( begin_form textinput password ... end_form ); } 1; #### [! use LibControls qw( begin_form, textinput, form_buttons, end_form ) !] [* begin_form('MyFormTitle', 'my_form_name', 'action_script_name'); textinput('Username', 'user', 140, 0, 'User Name'); form_buttons(); end_form(); *] <