You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using DecimalRangeField and IntegerRangeField data types, the actual value that the field is set to (in the resulting slider) is never rendered. This behavior is also present in your own official example:
Is there some undocumented way to render the value of the slider? Otherwise, its confusing to know what value is being submitted, especially for a large range of values.
The text was updated successfully, but these errors were encountered:
Inherit Field from wtforms and override its call descriptor, to return a custom html Field eg: Could be a span
In your FormClass inheriting from FlaskForm, instantiate the Class which returns the Custom Html field
In your frontend, Use JavaScript to target both the RangeField and the CustomHTML field
Register, an input eventListener on the RangeField, such that with a movement on the slider, the corresponding value is registered on the the customHTML element
``
Example flask app
forms.py
from wtforms import IntegerRangeField, Field
class IntegerIndexRangeValueLabel(Field):
def __call__(self,**kwargs):
return "<span id='integer_index_range_value'>0</span>"
class MyForm(FlaskForm):
integerslider = IntegerRangeField(render_kw={'min': '0', 'max': '4', 'step': '1'})
interger_slider_value = IntegerIndexRangeValueLabel(label='Slider Value')
In your templates folder, render the forms
Using Flask-bootstrap in this case
When using DecimalRangeField and IntegerRangeField data types, the actual value that the field is set to (in the resulting slider) is never rendered. This behavior is also present in your own official example:
http://173.212.227.186/form
Is there some undocumented way to render the value of the slider? Otherwise, its confusing to know what value is being submitted, especially for a large range of values.
The text was updated successfully, but these errors were encountered: