, click . .
( )
:
<FORM name="F_DESTINATION_DB" id="F_DESTINATION_DB" method="POST" onsubmit="return popConfirmationBox('<?php echo LanguageControler::getGeneralTranslation("DELETE_CONFIRMATION_MESSAGE", "Deleting is an irreversible action. Are you sure that you want to proceed to the deleting?");?> ','DELETE_DB_BUTTON')">
Javascript (in an external file for code reuse):
function popConfirmationBox(message, tagId){
var confirmation = true;
if (typeof tagId === 'string' && document.activeElement.id.toUpperCase() === tagId.toUpperCase()) {
if (typeof message === 'string' && message.length > 0) {
confirmation = window.confirm(message);
}
}
return confirmation;
}
It was quite difficult for me to do this (I need a lot of research and testing), but the resulting code is pretty simple.
By default, I assume that the confirmation is yes (in case the button pressed is not intended to display the message or if the user did not provide the correct message line).
Additional note . Of course, this code will not do the trick if the user browser blocks the client code.
I hope this helps someone
Jonathan Roland-Levenk from Montreal
source
share