Solved

Dynamic pop up menus

Posted on 1998-07-13
4
165 Views
Last Modified: 2013-11-28
I want to display a popup menu on my form. The options of this popup ought to come from a DB table.

e.g there could be a table having employee codes and employee names. I would like to display all the names in the DB table as a popup menu on a form for the user to be able to select any one.

Effectively which would mean that if any record is deleted from the DB we don't see that entry as an option on the popup menu.

Could somebody give me a way to do this.
0
Comment
Question by:sanjaychopra
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
b2pi earned 100 total points
ID: 1208401
Since you don't say what database you're using, or how you're getting the list of data from the database, it's a little difficult to be explicit, but you're looking for something along the lines of:


print "<SELECT NAME=\"Menu_Variable\">\n";
my(@datalist) = <source your data here>
foreach (@datalist) {
   print "<OPTION VALUE=\"$_\"> $_\n";
}
print "</Select>\n";



By the way, this isn't reallly a perl question, but rather an HTML question...
0
 

Author Comment

by:sanjaychopra
ID: 1208402
Thanks for your reply.

I think I need to elaborate upon the problem a bit more to get a more accurate answer from you.

I am using an Oracle Database.
I have a table with the following structure :

 Name                            Null?    Type
 ------------------------------- -------- ----
 ID                              NOT NULL CHAR(3)
 NAME                            NOT NULL VARCHAR2(30)
 AGE                                      NUMBER(38)
 SEX                                      CHAR(1)

Let us assume we have five records in this table.
Now I would like to have a pop up menu or a radio buttons
group listing all the ids that are there in the table.

I was approaching the problem by building an array which would have all the id's that there in the the table at the point of time and then trying to use this array with the the default method of showing popup menus in PERL.


      #print "<P><EM>Select an ID</EM><BR>";
        #$query->popup_menu(
        #                -name=>'id',
        #                -values=> [the name of the array that i am building]
        #                ),"<P>";
 
But somehow i am not able to do that.
Coule you help ne solving the problem by this approach.
0
 

Author Comment

by:sanjaychopra
ID: 1208403
Thanks for your reply.

I think I need to elaborate upon the problem a bit more to get a more accurate answer from you.

I am using an Oracle Database.
I have a table with the following structure :

 Name                            Null?    Type
 ------------------------------- -------- ----
 ID                              NOT NULL CHAR(3)
 NAME                            NOT NULL VARCHAR2(30)
 AGE                                      NUMBER(38)
 SEX                                      CHAR(1)

Let us assume we have five records in this table.
Now I would like to have a pop up menu or a radio buttons
group listing all the ids that are there in the table.

I was approaching the problem by building an array which would have all the id's that there in the the table at the point of time and then trying to use this array with the the default method of showing popup menus in PERL.


      #print "<P><EM>Select an ID</EM><BR>";
        #$query->popup_menu(
        #                -name=>'id',
        #                -values=> [the name of the array that i am building]
        #                ),"<P>";
 
But somehow i am not able to do that.
Coule you help ne solving the problem by this approach.
0
 
LVL 5

Expert Comment

by:b2pi
ID: 1208404
I'm sorry, I just saw that this message was here.

Ummm, two steps:

1.) Assuming that the array of values loaded from the database is called @tArr, try using

   -values => [@tArr],

Yes, Actually put the square braces in there.

2.) If that doesn't help, send more code... (i.e. the select code and the popup_menu code.  Also, tell me what happens when it runs.

Hopefully, step 1 will work.

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Marketing can be an uncomfortable undertaking, especially if your material is technology based. Luckily, we’ve compiled some simple and (relatively) painless tips to put an end to your trepidation and start your path to success.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now