Open marcoczen opened 2 years ago
Hi,
Currently in my PHP / HTML / BootStrap form I have a functional plain Javascript Confirmation Dialogs ( Proceed ? - Yes / No ) as follows;
:: JS Code ::
function actionConfirm(msg1) { if (confirm(msg1)) { return true; } else { return false; } } //end of actionConfirm const elems = document.getElementsByClassName('confirmProceed'); Array.prototype.forEach.call(elems, (elem) => { elem.addEventListener('click', (event) => { if ( !actionConfirm('Proceed with Action?') ){ event.preventDefault(); } }); }); // end Array.prototype.forEach
My php form is submitted by a button of type 'submit' and the javascript function by a class 'confirmProceed' as shown below:
:: PHP Form snippet ::
<button type="submit" class="btn_custom confirmProceed" name="button_delete" value="delete" title="Delete Item" >Delete</button>
Any idea how i can use the SweetAlert Dialog in the above code to provide better looking Confirmation Dialogs without removing the button of type 'submit' ?
Hi,
Currently in my PHP / HTML / BootStrap form I have a functional plain Javascript Confirmation Dialogs ( Proceed ? - Yes / No ) as follows;
:: JS Code ::
My php form is submitted by a button of type 'submit' and the javascript function by a class 'confirmProceed' as shown below:
:: PHP Form snippet ::
Any idea how i can use the SweetAlert Dialog in the above code to provide better looking Confirmation Dialogs without removing the button of type 'submit' ?