detection de modification CKeditor
Bonjour,
je cherche un moyen pour que dès qu'il y a une modification dans le champs texte de CKeditor, un avertissement soit donné avant toute fermeture ou changement de page à part avec le bouton ENREGISTRER...
j'ai bien trouvé un plugin : http://comment-faire-pour.fr/432/eve...ange-ckeditor/
mais je n'arrive pas à le modifier pour en faire ce que je veux...
j'avais trouvé ce code qui marche avec tous les champs sauf avec le CKeditor...
peut-on combiner ce code avec le plugin ?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| <script language="JavaScript">
var ids = new Array('nom','editor1','supp');
var values = new Array('', '', '');
function populateArrays()
{
// assign the default values to the items in the values array
for (var i = 0; i < ids.length; i++)
{
var elem = document.getElementById(ids[i]);
if (elem)
if (elem.type == 'checkbox' || elem.type == 'radio')
values[i] = elem.checked;
else
values[i] = elem.value;
}
}
var needToConfirm = true;
window.onbeforeunload = confirmExit;
function confirmExit()
{
if (needToConfirm)
{
// check to see if any changes to the data entry fields have been made
for (var i = 0; i < values.length; i++)
{
var elem = document.getElementById(ids[i]);
if (elem)
if ((elem.type == 'checkbox' || elem.type == 'radio')
&& values[i] != elem.checked)
return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?";
else if (!(elem.type == 'checkbox' || elem.type == 'radio') &&
elem.value != values[i])
return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?";
}
// no changes - return nothing
}
}
</script> |
en vous remerciant