Hi all,
I could solve the problem now. The RichTextField Update has to be triggered separately as already done in AgentTicketEmail.
Greets
Daniel
function submit_compose() {
// if RichText is enabled, update the hidden textarea now for the body content check to work correctly
if (typeof RichTextUpdateLinkedField == 'function') {
RichTextUpdateLinkedField();
}
var reg = /(xxx|XXX)/ ;
if (document.compose.To.value == "") {
[snip]
#-- MyH dob
else if ( reg.test(document.compose.Body.value) == true ) {
alert('$JSText{"Please remove placeholders in the body!"}');
if (typeof RichTextUpdateLinkedField == 'function') {
RichTextFocus();
}
else {
document.compose.Body.focus();
}
return false;
}
#--
else if [snip]
Von: dev-bounces@otrs.org [mailto:dev-bounces@otrs.org]
Im Auftrag von Obee, Daniel
Gesendet: Montag, 14. Januar 2013 16:08
An: Development community of OTRS
Betreff: [dev] document.compose.Body.value won't be updated on text input (OTRS 2.4.9)
Hi all,
we’re currently running 2.4.9 with RichText enabled.
I’m trying to block email sending if a mail contains placeholders (XXX). Therefor I tried to modify the function submit_compose in the AgentTicketCompose.dtl.
function submit_compose() {
var reg = /(xxx|XXX)/ ;
[snip]
else if ( reg.test(document.compose.Body.value) == true ) {
alert('$JSText{"There are still placeholders to be filled out!"}');
document.compose.Body.focus();
return false;
}
[snip]
The RegEx works and if the text is found I get the alert. Unfortunately it seems the document.compose.Body.value is not updated when I alter the text in the RichText editor. Reading out the variable I continue to get
the original body instead of the current content of the editor field.
Any ideas?
Greets & thanks
Daniel