Home : Products : DBMan SQL : Discussion :

Products: DBMan SQL: Discussion: Re: [regert] enum or set fields as html selects: Edit Log

Here is the list of edits for this post
Re: [regert] enum or set fields as html selects
Have you set your form types, form names, and form values in your table properties? If so, you can use the default template set and form generation routines to display those enum/set values in the desired format. For a custom template you'll want to use <%Dbsql::HTML::generate_checkbox('column_name')%> or the equivalent for radio, select, etc.

Or, for display purposes with a custom template, you could use the following global (thanks to TheStone for the code):

sub {
# Maps form_names to form_values and displays them
my $col = shift;
my $tags = GT::Template->tags;
my $cols = $tags->{home}->{db}->cols;
my $record = $tags->{results}[$tags->{row_num} - 1];
my $values = $cols->{$col}->{'form_values'};
my $names = $cols->{$col}->{'form_names'};
my @selected = split(/\n/, $record->{$col});
my (%hash, $output);
for (0 .. $#{$names}) {
$hash{$names->[$_]} = $values->[$_];
foreach ( @selected ) {
$output .= "$hash{$_}<br />" if ( $hash{$_} );
return "$output";

To get that to work, you would just reference the column name as the parameter for the subroutine, as in <%globalname('columnname')%>.

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund

Last edited by:

hennagaijin: Jan 24, 2003, 3:22 PM

Edit Log: