I have a form from Django defined as
from django.forms.widgets import RadioSelect
class SequenceInputForm(forms.Form):
sequence = forms.CharField(widget=forms.Textarea, validators=[validate_valid_dna_sequence])
organism = forms.ChoiceField(widget=forms.RadioSelect(), initial=1,choices=[(1,"Human"),(2,"Rat"),(3,"Mouse")])
The Radio button in the django template is rendered as
{{ form.organism }}
That renders a form with a simple TextBox and a radio selector on a template.Typical user interaction results in text in the sequence field and a click of the radio button.
The app then returns results on a new page
Now if the user hits the "back" button on chrome to go back to the form from the results page. The Text box has the data entered..but the radio button is reset to its initial value.
This lack of memory for the entered value is only in Google Chrome. In Firefox and IE with the same application code...the form "remembers" its Radio button selected value.
How do I make the form remember the value when the user browses back from the results page in Google chrome.
I am sorry the browser specific behavior gives me the impression that it needs a browser specific solution , probably not in the Django code .
I had read somewhere that a workaround is to use the "html5" session storage API to save the state of the radio button. Is this the best/only way to handle this?