Solved

Dynamic pop up menus

Posted on 1998-07-13
4
171 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Owning a franchise can be the dream of a lifetime. It provides a chance for economic growth. You can be as successful as you want.  To make your franchise successful, you need to market it successfully. Here are six of the best marketing strategies …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

726 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