Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dynamic pop up menus

Posted on 1998-07-13
4
Medium Priority
?
174 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
b2pi earned 200 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

[Video] Oticon Case Study

Open office environments can create the dynamics for innovation, but they also bring some challenges. With over 1,000 employees in an open office, Oticon needed a solution that would preserve the environment while mitigating disruptive background noises.

Watch how they did it.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For many of us, the  holiday season kindles the natural urge to give back to our friends, family members and communities. While it's easy for friends to notice the impact of such deeds, understanding the contributions of businesses and enterprises i…
We aren’t perfect, just like everyone else.  Check out the email errors our community caught and learn the top errors every email marketer should avoid.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Six Sigma Control Plans

618 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