File tree 3 files changed +10
-7
lines changed
3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 37
37
die ();
38
38
}
39
39
40
- if (!isset ($ _POST ['submit_formcreator ' ]) || !isset ($ _POST ['plugin_formcreator_forms_id ' ])) {
40
+ if (!isset ($ _POST ['add ' ]) || !isset ($ _POST ['plugin_formcreator_forms_id ' ])) {
41
41
http_response_code (500 );
42
42
die ();
43
43
}
Original file line number Diff line number Diff line change @@ -865,7 +865,7 @@ var plugin_formcreator = new function() {
865
865
}
866
866
}
867
867
868
- $ ( '[name="submit_formcreator "]' ) . toggle ( submitButtonToShow == true ) ;
868
+ $ ( '#plugin_formcreator_form.plugin_formcreator_form button [name="add "]' ) . toggle ( submitButtonToShow == true ) ;
869
869
} ) ;
870
870
} ;
871
871
@@ -1353,10 +1353,10 @@ var plugin_formcreator = new function() {
1353
1353
} ) ;
1354
1354
} ;
1355
1355
1356
- this . submitUserForm = function ( ) {
1356
+ this . submitUserForm = function ( event ) {
1357
1357
var form = document . querySelector ( 'form[role="form"][data-itemtype]' ) ;
1358
1358
var data = new FormData ( form ) ;
1359
- data . append ( 'submit_formcreator ' , '' ) ;
1359
+ data . append ( 'add ' , '' ) ;
1360
1360
$ . post ( {
1361
1361
url : formcreatorRootDoc + '/ajax/formanswer.php' ,
1362
1362
processData : false ,
@@ -1393,11 +1393,14 @@ var plugin_formcreator = new function() {
1393
1393
initMessagesAfterRedirectToasts ( ) ;
1394
1394
}
1395
1395
} ) ;
1396
+ event . preventDefault ( ) ;
1397
+ blockFormSubmit ( $ ( form ) , event ) ;
1398
+ return false ;
1396
1399
} ;
1397
1400
1398
1401
this . submitUserFormByKeyPress = function ( event ) {
1399
1402
var keyPressed = event . keyCode || event . which ;
1400
- if ( keyPressed === 13 && $ ( '[name="submit_formcreator "]' ) . is ( ':hidden' ) ) {
1403
+ if ( keyPressed === 13 && $ ( '#plugin_formcreator_form.plugin_formcreator_form button [name="add "]' ) . is ( ':hidden' ) ) {
1401
1404
event . preventDefault ( ) ;
1402
1405
return false ;
1403
1406
}
Original file line number Diff line number Diff line change 45
45
46
46
<div class =" asset" >
47
47
{% set formName = ' plugin_formcreator_form' %}
48
- <form name =" {{ formName }}" method =" post" role =" form" enctype =" multipart/form-data" class =" plugin_formcreator_form" action = " javascript: plugin_formcreator.submitUserForm()" onkeypress =" return plugin_formcreator.submitUserFormByKeyPress(event);" id =" plugin_formcreator_form" data-itemtype =" PluginFormcreatorForm" data-id =" {{ item .fields ['id' ] }}" data-submit-once =" true" >
48
+ <form name =" {{ formName }}" method =" post" role =" form" enctype =" multipart/form-data" class =" plugin_formcreator_form" onsubmit = " return plugin_formcreator.submitUserForm(event )" onkeypress =" return plugin_formcreator.submitUserFormByKeyPress(event);" id =" plugin_formcreator_form" data-itemtype =" PluginFormcreatorForm" data-id =" {{ item .fields ['id' ] }}" data-submit-once =" true" >
49
49
<h1 class =' form-title' >
50
50
{{ call(' Glpi\\Toolbox\\Sanitizer::unsanitize' , [__(item .fields ['name' ], options .domain )]) }}
51
51
<i class =" fas fa-print" style =" cursor: pointer;" onclick =" window.print();" ></i >
137
137
<div class =" center" >
138
138
{{ call(' Html::submit' , [
139
139
__(' Send' ),
140
- {' name' : ' submit_formcreator ' }
140
+ {' name' : ' add ' }
141
141
])| raw }}
142
142
</div >
143
143
{{ fields.hiddenField (' plugin_formcreator_forms_id' , item .fields ['id' ]) }}
You can’t perform that action at this time.
0 commit comments