troubleshooting Question

Select box

Avatar of lulu50
lulu50Flag for United States of America asked on
JavaScriptJScriptJSP
4 Comments1 Solution323 ViewsLast Modified:
Hi,

I have two select box one for

Type of posting
and
List of category

right now what it is doing if the user select type of posting it will load all the category that belong to the selected type of posting.

what I need to have is too keep the previous selection for list of category

I have type of posting working fine.  but I just have to do the same to the category.

here's what I have


<select name="SelSTPost" size="1" style="width: 180px;"
	onChange="setOptions(this.options[this.selectedIndex].value);"/>
		<option value="" selected="selected">Select type of posting</option>
		<cfoutput query="DispMainMenu">
		<cfif  (isdefined('FORM.SelSTPost')) AND (#FORM.SelSTPost# eq #DispMainMenu.MenuID#)>
		<option value="#DispMainMenu.MenuID#" selected="selected">#DispMainMenu.MainMenuName#</option>
		<cfelse>
		<option value="#DispMainMenu.MenuID#" >#DispMainMenu.MainMenuName#</option>
		</cfif>
		</cfoutput>
	</select>
	
-------------------------------------------
<select name="SelCatg" size="1" style="width: 180px;"/>
		<option value="" selected="selected">Select category</option>
	</select>  

-------------------------------------------

<script language="Javascript">  
function setOptions(chosen) {
var selbox = document.FRMAcc.SelCatg;
var getmySubCat = '<cfoutput>#myList#</cfoutput>';
var CTDataList = getmySubCat.split(",");

   selbox.options.length = 0;
   if (chosen == " " || chosen != "Select All") {  
   selbox.options[selbox.options.length] = new Option('Select category',' ');
   }

   for(var i=0, limit=CTDataList.length; i<limit; i+=3)  
if (chosen == CTDataList[i]) {
  selbox.options[selbox.options.length] = new
Option(CTDataList[i+2],CTDataList[i+1]);
}

}
ASKER CERTIFIED SOLUTION
Gurvinder Pal Singh

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. 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