This is a Drupal 7 module which uses the jQuery UI slider included in core to add a slider widget to number fields. The default number fields (decimal, float, and integer) are used as well as all validation and settings. One new instance setting is added: "step". Minimum and maximum are required to properly use the slider. The normal text-field input remains and is bound by a jQuery change event.
Link to sandbox page: http://drupal.org/sandbox/jrowny/1237204
Future releases will see:
-allow users to hide the default textfield
-a range field added which utilizes the slider to select a range.
This is my first time attempting a module but I did run it through coder. There's no new user output, no variables, and no database access going on with the exception of the one instance setting "step" so I'm hopeful that this won't cause a major headache for reviewers! Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | sliderfield.tar_.gz | 23.65 KB | mrfelton |
| #2 | sliderwidget.png | 1.55 KB | jrowny |
| sliderfield-7.x-1.x-dev.zip | 2.32 KB | jrowny |
Comments
Comment #1
rogical commenteddemo, screenshot would be helpful to let people konw what it is.
Comment #2
jrowny commentedAttached is a screenshot of the widget.
Comment #3
rogical commentedseems working fine with numbers, nice work!
I think it can also work with select, such as level1 -> level2 -> level3, this is very common especially in IDC products, provide several level of memory/cpu/harddisk.
Comment #4
jrowny commentedThanks rogical, it certainly could work with selects where the index of the selected item is based on the slider value. I will definitely put that on the planned feature list, but first I would like to knock out range support since I've seen that requested a few times.
Comment #5
jrowny commentedAs part of the review process I discovered I'm supposed to do some research and post about the different modules which may already do something similar.
There are two similar modules in existence:
This project is 6.x only. Does not support decimal or float input. Does not support prefixes/suffices (such as ", $, %, MM, etc.). Another fundamental difference is that cck_slider does NOT use the core number field widget form, instead it builds its own.
Notable Differences:
$element += number_field_widget_form($form, $form_state, $field, $instance, $langcode, $items, $delta, $element);, it should be more resilient to changes and updates to core field modules if they happen to change, add a setting, etc. (source: sliderfield.module line 28). The sliderfield module simply adds a process callback which provides settings and attaches the javascript.Comment #6
klausi* the lines in README.txt should not exceed 80 characters.
* you should implement hook_form_FORM_ID_alter() if you are targeting one specific form.
* "//use the default number field": comments should be on a separate line, start capitalized, end with a "." http://drupal.org/node/1354#inline
* Add the screen shot to your project page
* slider_process(): every function name should start with the name of your module to avoid name clashes. Rename to silderfield_process().
Comment #7
jrowny commentedThanks for the review klausi, renaming to sliderfield_process doesn't work because it tries to implement hook_process. I'll ask the module dev IRC folks for help on that.
Comment #8
mrfelton commentedFYI: I've fixed up all of these issues, and submitted patches to issue queue - http://drupal.org/project/issues/1237204.
@jrowny - I've requested co-maintainership of the module, as I'd like to help you get a release of this out the door. #1323184: Request for co-maintainership of sliderfield module.
Comment #9
jrowny commentedI granted the request for mrfelton to be a co-maintainer. Thanks!
Comment #10
jrowny commentedChanging the status because this module is now a full project. Or should I just mark it as closed? I noticed I don't have the permission to promote full projects, is that something done through this queue? Project: http://www.drupal.org/project/sliderfield
Comment #11
andypostThere's another 2 modules Elements & jSlider Form API with a similar functionality
Suppose it's better to extend them and not provide another one
EDIT Filed #1416822: Duplicate modules
Comment #12
jrowny commentedNeither of those do what sliderfield does. Sliderfield is a single input with a slider. The output is a single number.
Comment #13
andypost@jrowny I just point about duplication of efforts and suggest to join forces
there's another reply #1263616-4: jQuery UI form elements?
so I recommend to continue discussion in #1416822: Duplicate modules
Comment #14
klausiSo obviously mrfelton promoted this project. Marking as fixed, you can get back to us if you have a new project that you want to promote. Open a new project application issue for that then.
Comment #15
jrowny commentedThanks Klausi, will do.
Comment #16.0
(not verified) commentedadded sandbox link