Webman-framework

Lightweight, Component-based, and Database-oriented Web Application Framework

About | Overview | Documentation

 

Documentation > Modules and APIs > Select_Option

Select_Option

 

Description:

The core module to help generate HTML code for select form element (dropdown list box).

 

1. Instantiation and Basic Parameter Setting

my $s_opt = new Select_Option;


Option 1 - Manually set the captions and values of the dropdown list box options
$s_opt->set_Values("value_1", "value_2", "...", "value_n");
$s_opt->set_Options("option_1", "option_2", "...", "option_n");


Option 2 - Set the captions and values using items from database table..
$s_opt->set_DBI_Conn($db_conn);
$s_opt->set_Values_From_DBI_SQL($sql_str);
$s_opt->set_Options_From_DBI_SQL($sql_str);


Set current selected items of the dropdown list box to be generated.
$s_opt->set_Selected("value_1", "...", "value_n");



 
2. Generating Dropdown List Box

my $content = $s_opt->get_Selection;