Avatar of lulu50
lulu50
Flag for United States of America asked on

Select box

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]);
}

}

Open in new window

JavaScriptJScriptJSP

Avatar of undefined
Last Comment
lulu50

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Gurvinder Pal Singh

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
lulu50

ASKER
gurvinder372:

please take a look at my site:

http://www.churchesbulletin.com/post.cfm?s=ST&CHID=11


I think it need to be filtered if the form select box (type of post) has been selected.  

I don't think there is a need to create a cookie.

what do you think?
Gurvinder Pal Singh

Only reason why i suggested making a cookie was, because you mentioned that there is a requirement to go back to the previous selection of both the select boxes. Thats why i thought cookie is required
lulu50

ASKER
Thanks,
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy