Private
Public Access
1
0

hiddenfields

This commit is contained in:
Sander Roosendaal
2022-07-19 21:01:13 +02:00
parent 673731af26
commit 4758be79c0
3 changed files with 12 additions and 4 deletions

View File

@@ -151,8 +151,8 @@ class InstantPlanSelectForm(forms.Form):
# Instroke Metrics interactive chart form
class InstrokeForm(forms.Form):
metric = forms.ChoiceField(label='metric',choices=(('a','a'),('b','b')))
spm_min = forms.IntegerField(initial=15,label='SPM Min')
spm_max = forms.IntegerField(initial=45,label='SPM Max')
spm_min = forms.IntegerField(initial=15,label='SPM Min',widget=HiddenInput)
spm_max = forms.IntegerField(initial=45,label='SPM Max',widget=HiddenInput)
def __init__(self, *args, **kwargs): # pragma: no cover
choices = kwargs.pop('choices', [])

View File

@@ -60,10 +60,13 @@ $( function() {
range: true,
min: 0,
max: 60,
values: [ 15, 45 ],
values: [ {{ spm_min }}, {{ spm_max }} ],
slide: function( event, ui ) {
$( "#id_spm_min" ).val( ui.values[ 0 ]);
$( "#id_spm_max" ).val(ui.values[ 1 ] );
$( "#spm_min_info" ).text( ui.values[ 0 ]);
$( "#spm_max_info" ).text(ui.values[ 1 ] );
}
});
@@ -101,7 +104,10 @@ $( function() {
{{ form.as_table }}
</table>
<div id="slider-container">
<span>Stroke Rate Slider</span>
<span>SPM (slide to change):</span>
<span id="spm_min_info">{{ spm_min }}</span>
<span>&nbsp;-&nbsp;</span>
<span id="spm_max_info">{{ spm_max }}</span>
<hr id="slider-range" />
</div>
<input name='form' class="button" type="submit" value="Submit">

View File

@@ -2987,6 +2987,8 @@ def instroke_chart_interactive(request, id=0):
'form':form,
'the_script': script,
'the_div': div,
'spm_min': spm_min,
'spm_max': spm_max,
})