Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Jump Menu using CFSelect

New Here ,
Sep 16, 2009 Sep 16, 2009

I'm trying to create a query generated jump menu that will jump the user to a new page based on whatever option is selected from the drop down menu. I'm basically a little lost on handling the onChange action of the form. Here's the code I have so far.

<cfform action="pro/course.cfm?courseID=#rsCourses.courseID#" method="post">

<cfselect name="courselist"

size = "1"

    width="150"

    multiple = "No"

    message = "Select a course"

    query = "rsCourses"

    group="courseCategory"

    display ="courseName"

    onChange="courselist.selectedIndex=courseID"

    selected="courseID"

    value = "courseID"

    queryPosition = "Below"

   >

<option value = "">Select a course</option>

</cfselect>

</cfform>

1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 16, 2009 Sep 16, 2009

This is more of a JavaScript question than a CF question, I think: the onchange attribute is not specific to <cfselect>, it's just bubbled through to the generated <select> tag.

So just write a normal JavaScript event handler function (to do whatever), and call it from the onchange attribute.  Same as any JS event.

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 16, 2009 Sep 16, 2009
LATEST

I figured it out, you're right though. Here's what I got to work:

<cfform action="" method="get">

<cfselect name="courselist"

size = "1"

    width="150"

    multiple = "No"

    message = "Select a course"

    query = "rsCourses"

    group="cat_Name"

    display ="courseName"

    onchange="window.location='pro/course.cfm?courseID='+this.value;"

    selected="courseID"

    value = "courseID"

    queryPosition = "Below"

   >

<option value = "">Select a course</option>

</cfselect>

</cfform>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources