Dynamic Drop Downs

Posted on 2004-04-20
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;'GET','',false);
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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.


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

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!

Question has a verified solution.

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

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa‚Ķ
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

630 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