I try to make a drop-down menu after the form when the user selects (releases the mouse) one of the options from the menu. This code works fine in FF, but Safari for some reason does not submit the form. I rewrote the code using jquery to make sure that the jquery.submit () implementation was handled better by the browser. The same result, work in FF does not work in safari.
The following snippets are from the same page, which has a mixed django template language.
Here the js vanilla tries:
function formSubmit(lang) {
if (lang != '{{ LANGUAGE_CODE }}') {
document.getElementById("setlang_form").submit();
}
}
Here's a jquery attempt:
$(document).ready(function() {
$('#lang_submit').hide()
$('#setlang_form option').mouseup(function () {
if ($(this).attr('value') != '{{ LANGUAGE_CODE }}') {
$('#setlang_form').submit()
}
});
});
and here is the form:
<form id="setlang_form" method="post" action="{% url django.views.i18n.set_language %}">
<fieldset>
<select name="language">
{% for lang in interface_languages %}
<option value="{{ lang.code }}" onmouseup="formSubmit('{{ lang.name }}')" {% ifequal lang.code LANGUAGE_CODE %}selected="selected"{% endifequal %}>{{ lang.name }}</option>
{% endfor %}
</select>
</fieldset>
</form>
My question is: how can I get this to work in Safari?
source
share