max: 20,
multiple: true,
multipleSeparator: " ",
- /*formatItem: function(row, i, max) {
+
+ /*
+ formatItem: function(row, i, max) {
return row.n + " ("+ row.c +")";
},
formatResult: function(row, i, max){
return row.n;
- }*/
+ }
+ */
+
formatItem: function(row, i, max, value) {
return row[1].split(".")[0] + " (" + row[1].split(".")[1] + ")";
},
}
});
+
});
+ function submitClicked(e) {
+ if(!(browserTester('chrome') || browserTester('safari'))) {
+ $("input.submit")[0].disabled=true;
+ }
+ window.removeEventListener('beforeunload', beforeUnload, true);
+ }
+
+ function beforeUnload(e) {
+ if($("input#id_title")[0].value != "" || $("textarea#editor")[0].value != "" || $("input#id_tags")[0].value != "") {
+ return yourWorkWillBeLost(e);
+ }
+ }
+ window.addEventListener('beforeunload', beforeUnload, true);
+
var related_questions_url = "{% url related_questions %}";
</script>
<script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
<p class="title-desc">
{{ form.tags.help_text }}
</p>
- {% if not request.user.is_authenticated %}
- <input name="ask" type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" />
+ {% if not request.user.is_authenticated %}
+ <input name="ask" type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" onclick="submitClicked(event)"/>
{% else %}
- <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" />
+ <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" onclick="submitClicked(event)"/>
{% endif %}
</form>
</div>