Gossamer Forum
Home : Products : DBMan SQL : Discussion :

requirement for selection list?

Quote Reply
requirement for selection list?
I currently have a selection list which is generated with the following code:


intpositions builds the selection list with positions as the name of each field and ID as the value

I also have a column in intpositions called active. I would like to require each records value for active that equals no to NOT display is the selection list. I would also like to sort this list alphabetically.

Can anyone help me with this? I emailed Stone a few days ago , but haven't heard back.

Thank you
Quote Reply
Re: [afail77] requirement for selection list? In reply to
In this case, you have to create a global templatew which should be like:

sub {
my $tab = $DB->table('table_name');
$tab->select_options("ORDER BY column_name");
return { lists => $tab->select({ active => 1})->fetchall_hashref };

Now, you can use it in the template:

<select name="name...">
<%loop lists%>
<option value="<%primary_key%>"><%column_name%></option>

Hope that helps.