Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Dynamic Drop Downs

Posted on 2004-04-20
Medium Priority
Last Modified: 2010-04-06
I currently have a perl program that produces a Email responds form.

Located on it is 3 drop downs, model type, model series, and model name.

When the user selects the model type the page reloads and the model series and model name drop downs are populated.

At this point the user can ether select their specific model name, or they can select a series. If they select a series the page reloads again and the model names list get small base on the series selection.

I really would like to get rid of the page reloading after each selection. I attempted to use Javascript to populate the menus. But the problem I ran into was that when the page went forward and then hit the back button. The Series and Model field were generally blank and I could not get it to repopulate with the data they previosu selected.

Can someone point me at a system that I can look at using that will allow me to make 3 dynamic drop downs, without page reloaded.
Question by:elmic
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
LVL 12

Expert Comment

ID: 10869857
you can do it two ways

inline frames or just frames (may not work in your case)
XMLHTTP to get the values using javascript and update the dropdowns..

Here is an example...
var objXML = new ActiveXObject("Microsoft.XMLHTTP");
var html;
html = objXML.responseText
LVL 53

Expert Comment

ID: 10872560
The problem with dynamic content is that it is not part of the cached page, and the back button brings it back from the cache or reloads if there is no cache. I don't think using XMLHTTP will solve it because it is still populating dynamically and you are going to go back to teh original page when back is clicked.

To maintain state you would need to keep track of what was dynamically loaded on a cookie and then bring in the data from the cookie in the onload event.


Expert Comment

ID: 10876095
i have code that does that, but i dont think it will solve the back button problem as COBOL says, cookie or session would make sense to me.

also look at this
Industry Leaders: 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!


Expert Comment

ID: 10895356
My solution to this would be to use wither the onBack() event, or onUnload (if onBack is not supported in your target browser).

Have something like this....

// in the header somewhere or onload
var firstTime = 1;

// have this in header
function checkBack() {
  if (firstTime = 1) {
    firstTime = 0;
    return false;
  } else {
     return true;

//in body tag

<body onUnload="checkBack();">

The main problem i guess with using onUnload (if onBack is not supported) is that the above code will try and stop you from going back and load the old form regardless of whether or not the user is going back - they might just be browsing to a different page. You could however check the target page and match that against the last history item i guess. Its up to you whether or not you need it.

It does also require that you have the original code to load in the back button. You could just save that in another variable when clicking on a series, then reload back again if the checkBack funtion is triggered.

I hope this helps.

LVL 53

Expert Comment

ID: 10899752
onback event??????

Where exactly could I find documentation on that event?  I can seem to find it with reference to any browser I have used, an none of my normal references seems to have anything on it.

As for the unload event you cannot re-load off of it, because that would override the user.  You may be able to get a popup open, but you are not going to force a reload. The user is leaving and built in security will prevent you from interferring.  If that was possible a web site could prevent you from ever leaving and you would have to re-boot to get out of such pages.


Author Comment

ID: 10931141
Doesn't seem to be a good answer to this problem. What I end up doing was using java to move the values to a second hidden form, clearing the first and then submitting the second. This wasn't the desire effect, but it fixed some of the problems I've been encountering.

I'm going to leave this question open a bit long in hopes someone else comes up with a soultion.
LVL 53

Expert Comment

ID: 12096898
Could we make it PAQ and refund please.  The thread has value even if we di not give the user a solution they could implement.


Author Comment

ID: 12128919
What's a PAQ ?
LVL 53

Expert Comment

ID: 12132803
PAQ: Previously Answered Question. It is what we call questions that have been closed and saved to the knowledgebase


Accepted Solution

Lunchy earned 0 total points
ID: 12138099
Closed, 250 points refunded.
Friendly Neighbourhood Community Support Admin

Featured Post

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

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

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

730 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