• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

Dynamic Drop Downs

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.
0
elmic
Asked:
elmic
1 Solution
 
venkateshwarrCommented:
you can do it two ways

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

Here is an example...
<SCRIPT LANGUAGE="JavaScript">
<!--
var objXML = new ActiveXObject("Microsoft.XMLHTTP");
var html;
objXML.open('GET','http://www.google.com',false);
objXML.send();
html = objXML.responseText
alert(objXML.responseText);
//-->
</SCRIPT>
0
 
COBOLdinosaurCommented:
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.

Cd&
0
 
jkna_gunnCommented:
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
http://www.experts-exchange.com/Web/Web_Languages/PHP/PHP_Databases/Q_20943313.html#10854098
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
gimmeadrinkCommented:
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;
    //CODE TO RELOAD BACK TO ORGINAL PAGE
    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.

0
 
COBOLdinosaurCommented:
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.

Cd&
0
 
elmicAuthor Commented:
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.
0
 
COBOLdinosaurCommented:
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.

Cd&
0
 
elmicAuthor Commented:
What's a PAQ ?
0
 
COBOLdinosaurCommented:
PAQ: Previously Answered Question. It is what we call questions that have been closed and saved to the knowledgebase

Cd&
0
 
LunchyCommented:
Closed, 250 points refunded.
Lunchy
Friendly Neighbourhood Community Support Admin
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now