|
From: primalx2003 on 19 Jun 2008 10:50 I have a question. I have the following script for my page: <!--- store the selected Main_Group variable variable after the first select boxes submits itself ---> <cfif isDefined('form.select_Main_Group')> <cfset page.select_Main_Group = form.select_Main_Group> </cfif> <cfoutput> <form name="DropDown" method="post"> <!--- query DB for the first drop down list ---> <cfquery name="get_Main_Group" datasource="ds"> SELECT group_id, group_name FROM tblGroups </cfquery> <!--- first drop down list ---> <!--- NOTICE the onChange javascript event in the select tag, this is what submits the form after the first selection ---> <select name="select_Main_Group" required="yes" onchange="this.form.submit()"> <option>Select Main Group</option> <!--- dynamically populate the first drop down list based on the get_Main_Group query ---> <!--- NOTICE the CFIF within the option tag, this says, if the first selection has been made, display the chosen option when the page reloads ---> <cfloop query="get_Main_Group"> <option value="#group_id#" <cfif isDefined('form.select_Main_Group')><cfif form.select_Main_Group eq "#group_id#">selected</cfif></cfif>>#group_name#</option> </cfloop> </select> <p> <!--- if the first selection has been made, display the second drop down list with the appropriate results ---> <cfif isDefined('page.select_Main_Group')> <!--- query DB for second drop down list, based on the selected item from the first list ---> <cfquery name="get_Sub_Group" datasource="ds"> SELECT group_id, subgroup_id, subgroup_name FROM tblGroups WHERE group_id = #page.select_Main_Group# </cfquery> <!--- second drop down list ---> <select name="select_Sub_Group" required="yes"> <option>Select Subgroup</option> <!--- dynamically populate the second drop down list based on the get_Sub_Group query ---> <cfloop query="get_Sub_Group"> <option value="#subgroup_id#">#subgroup_name#</option> </cfloop> </select> </cfif> </form> </cfoutput> I am using onchange="this.form.submit()" but I don't want to submit the form. I tried using the onchange event but the values were not passing through. Can someone please help me. Thank you, Sevor Klu
From: GArlington on 19 Jun 2008 11:59 On Jun 19, 3:50 pm, "primalx2003" <webforumsu...(a)macromedia.com> wrote: > I have a question. I have the following script for my page: > > <!--- store the selected Main_Group variable variable after the first select > boxes submits itself ---> > <cfif isDefined('form.select_Main_Group')> > <cfset page.select_Main_Group = form.select_Main_Group> > </cfif> > <cfoutput> > <form name="DropDown" method="post"> > <!--- query DB for the first drop down list ---> > <cfquery name="get_Main_Group" datasource="ds"> > SELECT group_id, group_name > FROM tblGroups > </cfquery> > > <!--- first drop down list ---> > <!--- NOTICE the onChange javascript event in the select tag, this is what > submits the form after the first selection ---> > <select name="select_Main_Group" required="yes" > onchange="this.form.submit()"> > <option>Select Main Group</option> > <!--- dynamically populate the first drop down list based on the > get_Main_Group query ---> > <!--- NOTICE the CFIF within the option tag, this says, if the first > selection has been made, display the chosen option when the page reloads ---> > <cfloop query="get_Main_Group"> > <option value="#group_id#" <cfif > isDefined('form.select_Main_Group')><cfif form.select_Main_Group eq > "#group_id#">selected</cfif></cfif>>#group_name#</option> > </cfloop> > </select> > <p> > <!--- if the first selection has been made, display the second drop down list > with the appropriate results ---> > <cfif isDefined('page.select_Main_Group')> > <!--- query DB for second drop down list, based on the selected item from > the first list ---> > <cfquery name="get_Sub_Group" datasource="ds"> > SELECT group_id, subgroup_id, subgroup_name > FROM tblGroups > WHERE group_id = #page.select_Main_Group# > </cfquery> > > <!--- second drop down list ---> > <select name="select_Sub_Group" required="yes"> > <option>Select Subgroup</option> > <!--- dynamically populate the second drop down list based on the > get_Sub_Group query ---> > <cfloop query="get_Sub_Group"> > <option value="#subgroup_id#">#subgroup_name#</option> > </cfloop> > </select> > </cfif> > </form> > </cfoutput> > > I am using onchange="this.form.submit()" but I don't want to submit the form. ??? Please explain yourself. > I tried using the onchange event but the values were not passing through. ??? > Can someone please help me. > > Thank you, > > Sevor Klu
From: Dan Bracuk on 19 Jun 2008 12:31 Sounds like you are trying to implement a concept called Related Selects. I did it once, like this http://www.pathcom.com/~bracuk/code/RelatedSelects.htm
|
Pages: 1 Prev: CFFTP fails with Coldfusion/oroinc/net/SocketClient Next: cfgrid valuesdisplay |