Select box

Posted on 2011-10-04
Last Modified: 2012-05-12

I have two select box one for

Type of posting
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;"
		<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>
		<option value="#DispMainMenu.MenuID#" >#DispMainMenu.MainMenuName#</option>
<select name="SelCatg" size="1" style="width: 180px;"/>
		<option value="" selected="selected">Select category</option>


<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


Open in new window

Question by:lulu50
    LVL 40

    Accepted Solution

    why don't you store the values (both posting and categories) in cookies, when the selection in posting select box is made?

    Author Comment


    please take a look at my site:

    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?
    LVL 40

    Expert Comment

    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

    Author Closing Comment


    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
    JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
    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)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now