Jump to content

InputfieldFloatRange - A range slider InputField


Recommended Posts

Hi! I've created a small Inputfield module called InputfieldFloatRange which allows you to use an HTML5 <input type="range" ../> slider as an InputField. I needed something like this for a project where the client needs to be able to tweak this value more based on 'a feeling' than just entering a boring old number. Maybe more people can use this so I'm hereby releasing it into the wild. 

EDIT: You can now install it directly from the Modules directory: http://modules.processwire.com/modules/inputfield-float-range/


What is it?

The missing range slider Inputfield for Processwire. 

What does it do?

This module extends InputfieldFloat and allows you to use HTML5 range sliders for number fields in your templates.
It includes a visible and editable value field, to override/tweak the value if required.  


  • Min/max values
  • Precision (number of decimals)
  • Optional step value (Read more)
  • Optional manual override of the selected value (will still adhere to the rules above)
  • Configurable rounding of manually entered values (floor, round, ceil, disable)


  • Clone / zip repo
  • Install FieldtypeFloatRange, this automatically installs the Inputfield
  • Create new field of type `Float (range)` or convert an existing `Float`, `Integer` or `Text` field.
  • To render the field's value simply echo `$page->field`


A field with Min=0, Max=1, Step=0.2, Precision=2


Field with settings Min=0, Max=200, Step=0.25, Precision=2




  • Make the display-field's size configurable (will use the Input Size field setting) 
  • Hopefully become redundant



007 (current version)
- Add defaultValue field (as requested by @charger)
- Fix a silly mistake where a negative rounding (-1) resulted in removing all decimals instead

- Fix bug where InputfieldFloat negative precision prevented the displayed value to be updated properly
- Revert installs & requires, so direct installs from Modules Directory (should) work

- Fix bug where the Inputfield would not work properly within repeaters / repeater matrices

- Make rounding of manually entered values configurable (floor, round, ceil or disable)
- Fix small JS bug where the value-display field was not displayed
- Update README

- Code cleanup, add some ModuleInfo data & LICENSE
- Submit to PW Modules directory (http://modules.processwire.com/modules/inputfield-float-range/)

- Fix issue where setting the step value to an empty value created problem with validation
- Make the display-field optional

- Initial release






  • Like 9
  • Thanks 1
Link to comment
Share on other sites

48 minutes ago, bernhard said:

Hi @eelkenet, thx for sharing ? Did https://modules.processwire.com/modules/range-slider/ not work for you or did you need other features? Would be nice to see the differences between your modules.

To be honest I didn't check out that module in a long time, and had even forgotten it existed.. ?

But the major differences would be FieldtypeRangeSlider is a full-fledged module with its own API, depends on jQueryUI, and.. has not been updated in 5 years. The one I created is much simpler and light-weight: it's really just a basic HTML5 <input type='range'> with some styling, feedback and validation. As such, it is just another way to use the regular Float/Integer inputfields.  

  • Like 5
  • Thanks 1
Link to comment
Share on other sites

The module has been updated to 004 005. Besides a small JS bugfix, this update makes the rounding of manually entered values configurable (floor, round, ceil or disable completely). 

Edit: As of version 005 it also works within repeaters / repeater matrix, thanks to @Robin S' help

Edited by eelkenet
Updated to 005
  • Like 1
Link to comment
Share on other sites

  • 3 years later...

Would be cool if the field allows for a default value (next to min and max), so e.g. when min is 0 and max is 1, it currently defaults to 0.5, but I would sometimes prefer the default to be 0. @eelkenet would this be complicated to implement?

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...