Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4580682
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:49:03+00:00 2026-05-21T20:49:03+00:00

I have a cfselect which is working fine. I have an onclick event to

  • 0

I have a cfselect which is working fine. I have an onclick event to refresh the binding to the cfselect because the query contents keep changing quite frequently and I want the users to have the updated list.Now i want to add “Select any Bus” as the first option which I am not able to do.

I tried adding a row to the query result ahead of it being returned from my cfc. But I am not able to select any other value other than ‘Select any Bus’.

My cfselect code is:

<cfinvoke component="getCalculatorData" method="getAllBus"  argumentcollection="#houseArgs#" returnvariable="qry_busList">
<cfform style="align:centre" id="frm_drpDwnBus" name="frm_drpDwnBus"> 
<cfinput name="hdnrr" value="#rrSbstring#" type="hidden">
<cfselect name="dpDwnBs" bindOnLoad="true" 
  bind="cfc:getCalculatorData.getAllBus(hdnrr.value)" 
  value="busType_id_pk" 
  display="busType_name" >
  onclick="javascript:refresh(hdnrr.value)"
  <option value="0" on>Select a Bus</option>
</cfselect> 
</cfform> 

My cfc:

SELECT busType_id_pk
,busType_name FROM tbl_bustype
WHERE busType_railroad_letter=

javascript:

function refresh(s)
 {
  ColdFusion.Bind.assignValue('dpDwnBs','value', dataCalcu.getAllBus(s))
 }

As soon as i remove the onclick event all works fine. Please help me out here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T20:49:04+00:00Added an answer on May 21, 2026 at 8:49 pm

    Having misread the question originally, let’s take another swing.

    A standing onclick bind event on a select box will never work. To use a select box the way most people do, you click it twice: once to drop it down, and once to select your item. However, on the first click you reset the item. Even if the box stays open (I suspect this might be browser dependent, but hanven’t really tested), the second click will also reset it, meaning that you’ll lose your selection, as the selected item is destroyed and recreated as a new DOM node.

    I can think of three solutions.

    First, you can add a refresh button to the form, and refresh the values in the select box then.

    Second, you can use jQuery or similar to bind the event, and then onclick refresh the option list and then remove the onclick event binding. This means that the user can only refresh the options once, but (hopefully) that should be enough. If the page uis used multiple times (via AJAX for example) you can rebind the onclick refresh event on submission.

    Finally, display the form item as an uneditable text field (onfocus=”blur();” IIRC). Add a button, or change the focus event to launch a modal window that pulls the options from your CFC via AJAX or similar and displays them, so that anytime they choose to edit this item, they get a new set of choices.

    All of these have the disadvantage of not preserving previous selections, as the bind refresh destroys all the option odes and builds a new option list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have following listener for keyboard ArrowDown event(it's key code is 40 ): window.onload =
**Have it working now. I forgot to populate the Array List. How embarrassing. I'm
Have finally got a responsive site working (of a fashion). What I want to
Have posting working wonderfully, and reading the response happily EXCEPT when one of the
Have a linking (or ref) table which has a dual primary key. Need to
I have a CFQUERY pulling three columns. The following CFSELECT allows the user to
Have anyone used Redmine Documentor which lets you convert PHP to HTML to Redmine
Have a fun issue with sharepoint calendar view filtering. That code works fine: SPSecurity.RunWithElevatedPrivileges(delegate()
If you have a cfselect command that builds its options list from a getter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.