Question

Build dynamic HTML drop-down box

Asked by: cvfrancis

I need to create a drop down box using the values in the working-storage of a COBOL program. The program passes the value to HTML page using a utility available on the system.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-01-25 at 09:24:04ID23111696
Tags

HTML, JS

,

IE 5

Topics

Macromedia Homesite

,

Miscellaneous Web Development

,

Hypertext Markup Language (HTML)

Participating Experts
2
Points
375
Comments
9

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. dynamic html
    where can I get more information and tutorials on dynamic html, esp what it can do, what version of browser can run it...etc.
  2. Is there any erperts page for COBOL?
    Is there any erperts page for COBOL?
  3. HTML to PDF
    My company is looking for a way to automatically convert its sales reports (normally HTML) to PDF files, and send it to a seperate drive on the network (acts as an archive). How would I accomplish this?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: b0lsc0ttPosted on 2008-01-25 at 10:20:30ID: 20744867

cvfrancis,

What is the relation of the utility to the page where you want the drop down?  Does the web server support a server language (e.g. ASP, PHP, Perl, Coldfusion)?  Is the utility accessible to the web server and how?  Is this an Internet page or part of some intranet page?

HTML on its own isn't dynamic and can't "create" a drop down.  Clientside script can do it but usually won't be able to access data on the web server, especially if the page is an Internet page.  Please provide answers to the questions above and those details will hopefully clear this up and let us answer better.

Let me know if you have any questions or need more information.

b0lsc0tt

 

by: cvfrancisPosted on 2008-01-25 at 11:55:40ID: 20745774

Mr SCott:

I work with my database on a Unisys mainframe, accessed by COBOL, and at the fron-end is a web page to querry and update the DB. The internet page is built with HTML & JS.
THe utility that I am referring to is WEBPCM that sits in between the client, the mainframe and the server. It verifies the request from the client, pulls the data from the mainframe and send it to the server. The mainframe is Unisys system. We have a number of applications with HTML, JavaScript & COBOL accessing data and editing the data on the mainframe.
The web service itself is menu-driven, in the sense: we have a number of options on the home page. Each option has links and input fields to "SUBMIT" to the server to get the results. The system works fine.
Just as we fill the input fields and then submit the request, I need a drop-down box the values of which need to be dynamically filled (by pulling the data from the database at the time of initial handshake) and then submit the querry request.
To be more specific, if the data against the query is availabke for the months of October 2006 through March 2007, The drop down box for the month will display only October, November, December, January, February & March. The drop down box for the year will have only 2006 & 2007.
I have no problem in getting these months and years to the COBOL at the instant of initial hand-shake. But how to move them to the HTML drop down box?

Shall be grateful for the solution.

 

by: cvfrancisPosted on 2008-01-31 at 09:42:03ID: 20788964

Is my question in the "Neglected List"?
Mr Scott: Can you please help?

Thanks!

 

by: b0lsc0ttPosted on 2008-01-31 at 15:17:02ID: 20792435

cvfrancis,

This question isn't on the neglected list.  I can put it on the list but I want to ask a few things and make another suggestion.

Which part of that process actually "writes" the html and Javascript?  I am a little confused about it and that will be a key to this.  It seems like that is what you need to change to make the dynamic drop-down work.  I am not real clear how WEBPCM ties into this but that may not be important.  If you disagree then please clarify what it does.  If WEBPCM is the key then what programming or scripting language does it use?

HTML and Javascript alone aren't going to be able to get the info.  HTML isn't dynamic at all so it is no help.  However it sounds like you have something in this process that is making the html and javascript and doing it with the data.  That is what we need to use (assuming I understood you correctly).

Those were the questions and my confusion.  Now for the suggestion.  This question isn't in zones that will help you.  If you'd like to explain a little more I can try to suggest some zones and I can help you close this and open a new question.  As a Zone Advisor I can even change the zones if you want to just move this.  Once we do that then we could look at making this "neglected."  Making this neglected as it is now will just alert experts in these zones and I doubt that is your best audience (Homesite and HTML).  If COBOL is producing the html/javascript and accessing the data then it would be one of the zones I would suggest.

Let me know what you think of this and how you want to proceed.  I will do what I can to help.  Even if it is out of my expertise I can help you get experts to see it.  If I have misunderstood something then let me know.  In some ways I hope that is the case and, with that clarification, I will be able to suggest the simple solution.  I am not holding my breath on that though. ;)

bol

 

by: cvfrancisPosted on 2008-01-31 at 19:34:00ID: 20793913

Dear Mr Scott:

As I have already mentioned in the previous mail, I am able to pull the data from the database and pass it to the HTML at "ONLOAD".

The data which is to be displayed on the form is availabke for the months of October 2006 through March 2007 in the database. At "onload", the months are pulled by COBOL and available to the html in the array defined as
     var MonthsIn [];
I am able to populate the MonthsIn[] with the months October through March, and display the array fields in the javascrpt as  MonthsIn[0] = October, MonthsIn[1] = November, etc using the alert().

Similarly, the years are available in another array
     var YearsIn [] and YearsIn[0] = 2006,  YearsIn[1] = 2007.

I need to create drop-down boxes on the form using the JavaScript (JS function called by html).

The drop down box for the months need to have the values October, November,..., March only.
If "December" is selected, value 12 sould be returned by the function like the <select> element of the html:

<select name = "month">
 <option value = "12"  >December</option>
<option value ="01"  >January</option>
.....
</select>

 Similarly for the years.

I have tried, but the script is not returning the required results.

Please let me know if you need any further clarification.

Thanks in advance!

Francis  
 

The drop down box for the month will display only October, November, December, January, February & March. The drop down box for the year will have only 2006 & 2007.

 

by: b0lsc0ttPosted on 2008-01-31 at 20:44:07ID: 20794285

That doesn't really clear up what I really need.  I am afraid a point I have tried to make is getting missed.  Let me see if I can do better this time.

HTML doesn't have variables.  It isn't dynamic at all.  It sounds like COBOL may be making the html but your description is misleading so I am not sure that is the case.  Nothing could possibly be passed to html, whether onload or at some other time.  It may help if you show and example and explain what you think is the array "available to html."  I think this may be Javascript but parts of it do not look like Javascript.  Since it is the "array" part that is a concern.

You did clarify what you wanted in the drop downs and that helped a lot.  Thanks!  I hope my explanation and info above helps.  Let me see the html page you get.  Let me know if you need steps to get this.  If the info for the drop downs is there in javascript then hopefully I just need to add to it.  However it would seem that if you could add javascript you could modify what makes the html and javascript to do what you want.  It is much better to send the right stuff to the browser instead of depending on javascript (and thus the browser) to do the work.

Let me know if anything I have said isn't clear.

bol

 

by: cvfrancisPosted on 2008-02-02 at 10:44:24ID: 20805375

Dear Scott:

I am sorry if I was not clear about the variables and arrays availabe to the HTML.

As we can embedd the JS statements within HTML with <script> and </scipt> tags, and variables can also be included here (as in the JS), can I say that we can have variables within HTML? I was not explicit on this in my comments last time. Again sorry about that.

Similarly, the WEBPCM has arrays that can be defined within JS, and this can be put in the HTML within the <script> </scrpt> tags.

An example:

<body...>
<form ...>
<table  ...>
<tr...><td..></td></tr>

<script type = "text/javascript", language= "JavaScript">
var MonthsIn = [$replace-begin "replace=COB-MONTH",$replace-end];
</script>
..
</TABLE></BODY>

MonthsIn is the array to hold the element COB-MONTH.
The COB-MONTH variable is defined within COBOL, again in an array within the COBOL. At the initial process, COBOL populates the COB-MONTH values within its WORKING-STORAGE. If the data available in the Database is for the months of August through December, the COBOL assigns the values to COB-MONTH as follows:

COB-MONTH(1) = "AUGUST"
COB-MONTH(2) = "SEPTEMBER"
COB-MONTH(3) = "OCTOBER"
COB-MONTH(4) = "NOVEMBER"
COB-MONTH(5) = "DECEMBER"

Thease values are passed to the HTML at initialization and availabe to HTML at "onload" event.

The JavaScript can access these values as MonthsIn[0], MonthsIn[1], MonthsIn[2], etc. , where

MonthsIn[0] = "AUGUST"
MonthsIn[1] = "SEPTEMBER"
MonthsIn[2] = "OCTOBER"
MonthsIn[4] = "NOVEMBER"
MonthsIn[5] = "DECEMBER"

I am able to display these with alert(). Now I want to build the drop-down box that will use the array values "AUGUST" through "DECEMBER".

I was trying a javascript function to format the statements for the array on the following lines:  

function getMyMonth(Mthcode)
{
for (var i =0; i < MonthsIn.length - 1; i+=1)
var month = MonthsIn[i];

Line1 = " '</select id = "MonthId" name= "Month" size=1>' ;
Line2 = " '<option value = " ' +(value to be passed) + '>' + month + '</option>' ;
Line3 = " '</select>';

HtnlLine = Line1+Line2+Line3;
return HtmlLine;
}

I am still working on it, and meanwhile trying to get some help too.

Thanks!

Francis



 
 
 

 

by: frbcoindudePosted on 2008-02-22 at 14:18:45ID: 20962038

Was reading your thread and my interest got peaked.    I use JS scripts a lot in my development sites.

I believe the answer to your question is within your reach.  
Just wrap your 'generated' html code in a statement
     document.write(' ---html code --- ');.  

Dont see a need for the function.  Here is what I wrote up for you....  First write is only created once for the Select drop-down code.  Then we have multiple Options, which are handled by the loop.
And last, you close of the Select with the ending format.

Should look like this...

document.write('</select id = "MonthId" name= "Month" size=1>' ;
for (var i =0; i < MonthsIn.length - 1; i+=1)
      document.write('<option value = " ' + (value to be passed) + '>' + MonthsIn[i] + '</option>' ;
document.write('</select>');

No testing has been done on this code, but I'll help you try to debug it.

Bob

 

by: cvfrancisPosted on 2008-03-01 at 15:49:17ID: 31425012

Thanks Bob!

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...