1616 <button id =" bpSaveButtonsGroup" type =" button" class =" btn btn-success dropdown-toggle" data-toggle =" dropdown" aria-haspopup =" true" aria-expanded =" false" ><span class =" caret" ></span ><span class =" sr-only" >▼ ; </span ></button >
1717 <div class =" dropdown-menu" aria-labelledby =" bpSaveButtonsGroup" >
1818 @foreach ( $saveAction [' options' ] as $value => $label )
19- <button type =" submit " class =" dropdown-item" data-value =" {{ $value } }" >{{ $label } } </button >
19+ <button type =" button " class =" dropdown-item" data-value =" {{ $value } }" >{{ $label } } </button >
2020 @endforeach
2121 </div >
2222 @endif
@@ -76,7 +76,7 @@ function changeTabIfNeededAndDisplayErrors(form) {
7676
7777 var selector = $ (' #bpSaveButtonsGroup' ).next ();
7878 var form = $ (selector).closest (' form' );
79- var saveActionField = $ (' [name="save_action "]' );
79+ var saveActionField = $ (' [name="_save_action "]' );
8080 var $defaultSubmitButton = $ (form).find (' :submit' );
8181 // this is the main submit button, the default save action.
8282 $ ($defaultSubmitButton).on (' click' , function (e ) {
@@ -85,22 +85,22 @@ function changeTabIfNeededAndDisplayErrors(form) {
8585 // if form is valid just submit it
8686 if (checkFormValidity (form)) {
8787 saveActionField .val ( $saveAction .attr (' data-value' ) );
88- form . submit ();
88+ form[ 0 ]. requestSubmit ();
8989 }else {
9090 // navigate to the tab where the first error happens
9191 changeTabIfNeededAndDisplayErrors (form);
9292 }
9393 });
9494
9595 // this is for the anchors AKA other non-default save actions.
96- $ (selector).find (' a ' ).each (function () {
96+ $ (selector).find (' button ' ).each (function () {
9797 $ (this ).click (function (e ) {
9898 // we check if form is valid
9999 if (checkFormValidity (form)) {
100100 // if everything is validated we proceed with the submission
101101 var saveAction = $ (this ).data (' value' );
102102 saveActionField .val ( saveAction );
103- form . submit ();
103+ form[ 0 ]. requestSubmit ();
104104 }else {
105105 // navigate to the tab where the first error happens
106106 changeTabIfNeededAndDisplayErrors (form);
0 commit comments