mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 22:04:23 +00:00
Debug When leaving a report form page without modification, warning pop up is shown - refs #391
This commit is contained in:
parent
a327f581c5
commit
fdf6ac0bbf
@ -29,23 +29,10 @@
|
||||
<button class="sc-button red margin-10" type="reset"><i class="fa fa-eraser"></i> {{ 'Reset report'|trans }}</button>
|
||||
</div>
|
||||
{{ form_end(edit_form) }}
|
||||
|
||||
<script type="text/javascript">
|
||||
var form = $("form[name='{{ edit_form.vars.form.vars.name }}']").data('serialize',$("form[name='{{ edit_form.vars.form.vars.name }}']").serialize());
|
||||
// On load save form current state
|
||||
var submittedOk{{ edit_form.vars.form.vars.name }} = false;
|
||||
form.bind('submit', function(e) {
|
||||
submittedOk{{ edit_form.vars.form.vars.name }} = true;
|
||||
});
|
||||
{% endblock %}
|
||||
|
||||
$(window).bind('beforeunload', function(e){
|
||||
if($("form[name='{{ edit_form.vars.form.vars.name }}']").serialize()!=$("form[name='{{ edit_form.vars.form.vars.name }}']").data('serialize')){
|
||||
if (submittedOk{{ edit_form.vars.form.vars.name }} == false) {
|
||||
return "{{ 'You are going to leave a page with unsubmitted data. Are you sure you want to leave ?'|trans }}";
|
||||
}
|
||||
}
|
||||
e=null;
|
||||
// i.e; if form state change show box not.
|
||||
});
|
||||
{% block js %}
|
||||
<script type="text/javascript">
|
||||
chill.protectUnsavedDataForFrom('form[name="{{ edit_form.vars.form.vars.name }}"]', '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@ -29,22 +29,10 @@
|
||||
<button class="sc-button red margin-10" type="reset"><i class="fa fa-eraser"></i> {{ 'Reset report'|trans }}</button>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
<script type="text/javascript">
|
||||
var form = $("form[name='{{ form.vars.form.vars.name }}']").data('serialize',$("form[name='{{ form.vars.form.vars.name }}']").serialize());
|
||||
// On load save form current state
|
||||
var submittedOk{{ form.vars.form.vars.name }} = false;
|
||||
form.bind('submit', function(e) {
|
||||
submittedOk{{ form.vars.form.vars.name }} = true;
|
||||
});
|
||||
{% endblock %}
|
||||
|
||||
$(window).bind('beforeunload', function(e){
|
||||
if($("form[name='{{ form.vars.form.vars.name }}']").serialize()!=$("form[name='{{ form.vars.form.vars.name }}']").data('serialize')){
|
||||
if (submittedOk{{ form.vars.form.vars.name }} == false) {
|
||||
return "{{ 'You are going to leave a page with unsubmitted data. Are you sure you want to leave ?'|trans }}";
|
||||
}
|
||||
}
|
||||
e=null;
|
||||
// i.e; if form state change show box not.
|
||||
});
|
||||
{% block js %}
|
||||
<script type="text/javascript">
|
||||
chill.protectUnsavedDataForFrom('form[name="{{ form.vars.form.vars.name }}"]', '{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||
</script>
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user