}
});
+
});
+ 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 != "") {
- yourWorkWillBeLost(e);
+ return yourWorkWillBeLost(e);
}
- return false;
}
window.addEventListener('beforeunload', beforeUnload, true);
<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" onclick="window.removeEventListener('beforeunload', beforeUnload, true)" />
+ <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" onclick="submitClicked(event)"/>
{% endif %}
</form>
</div>