Opened 15 years ago

Closed 14 years ago

Last modified 11 years ago

#4958 closed enhancement (fixed)

Need an 'onSelect' event for slider... especially for Ajax apps

Reported by: guest Owned by: bill
Priority: high Milestone: 1.1
Component: Dijit - Form Version: 0.9
Keywords: Cc:
Blocked By: Blocking:


Here's what I would like to do..

I would like to trigger an action when any one of the following occurs:

a) The user clicks on the slider bar ("clickSelect")

b) The user slides the slider to a position and then releases the mouse button

What I don't want is for my action to execute for every intermediate value when the user is sliding. I can't set intermediateChanges to false because I still need the textbox updating to tell the user what value they're on during the slide (I do this with onChange). But I only want something to fire when the user has found the right value, stops and releases. Essentially, I'm looking to simulate an onSelect (vs an onChange).

I think an appropriate name for the event I am trying simulate would be 'onSelect'. I think that would cover both cases...

a) When the user is sliding and stops and releases the mouse button.

b) When the user clicks on the slider bar to have the slider jump to that location.

My thinking is that both an onClick on the slider bar as well as an onClick (or onMouseUp?) on the slider handle should constitute and onSelect. In other words...

a) If the user clicks on the slider bar, onSelect would be triggered.

b) If the user slides the handle (by clicking and holding mouse button down) to the position he wants and releases (mouseUp) this would also trigger onSelect.

c) As for A11y, I guess the same thing, only use keyUp.

I think in these cases, it is a reasonable assumption that the user is where he wants to be and expects the appropriate action to be triggered. I know some users will click on the slider bar repeatedly to get where they want, but that's just something I would have to deal with... user would learn eventually if the corresponding action takes too long.

To see the original discussion on this, please look here...


Change History (8)

comment:1 Changed 15 years ago by guest

For an example of what I'm talking about, you can go here.

There are a couple sliders on the lift hand slide. All of them update a text field as you slide to let you know what value you're on. But the 'select' action doesn't occur until you release the mouse button.

P.S. If the link doesn't work for some reason, just go to and search projects for any key word.

comment:2 Changed 15 years ago by bill

Owner: set to Douglas Hays

Hmm, Doug, could he just connect to setValue() to see the intermediate changes (using <script type="dojo/connect" event="setValue">, and then set intermediateChanges=false and use onChange() for seeing the final value?

comment:3 Changed 15 years ago by Douglas Hays

Milestone: 1.1


comment:4 Changed 14 years ago by Douglas Hays

(In [12147]) References #4958. Dragging slider handle was sending onChange events instead of intermediate changes.

comment:5 Changed 14 years ago by Douglas Hays

The onselect concept can already be accomplished via:

<script type="dojo/connect" event="setValue">
if(arguments[1] === true || typeof arguments[1] == "undefined"){
var onselectvalue = arguments[0];

A small change was made to the 1.1 slider so that the 2nd argument to setValue would be = false when the slider handle is being dragged. Previous versions had an undefined 2nd parameter which would have been interrpreted as a significant user value change.

comment:6 Changed 14 years ago by Douglas Hays

Owner: changed from Douglas Hays to bill

bill, do you think this connect script should be documented somewhere. It's not specific to slider.

comment:7 Changed 14 years ago by bill

Resolution: fixed
Status: newclosed

If you can document the two parameters to onChange() that would be great. The thing is that they only apply to certain widgets (slider and spinner come to mind). For something like NumberTextBox? the second parameter will always be true IIUC. And of course for checkbox and radio onChange reports changes to the checked state, not to the value. So I think onChange needs to be documented per widget. Like on, not just on page

I added a TODO to the book: to remember to do this.

In any case sounds like we can close this bug. Thanks for fixing!

comment:8 Changed 11 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.