Re: document.compose.Body.value won't be updated on text input (OTRS 2.4.9)

"Obee, Daniel" <[email protected]>
Newsgroups gmane.comp.otrs.devel
Message-ID <6C4C03F6CE6BE549B8DBFB341BFD687E9B0ADC7F@berlinexs01.myhammer.intra>
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: [email protected] [mailto:[email protected]] 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

_______________________________________________
OTRS mailing list: dev - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/dev
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.