CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Tokens not being inserted in CiviMail or 'send an email'
Pages: [1]

Author Topic: Tokens not being inserted in CiviMail or 'send an email'  (Read 1916 times)

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Tokens not being inserted in CiviMail or 'send an email'
June 20, 2011, 01:16:14 am
Is this just me? Can't test on Demo for civimail - ah but now i see the problem on our site is in 'send an email' ah but of course can't test that on Demo either. Can anyone verify if 4.0.3 they can insert tokens? thanks
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Tokens not being inserted in CiviMail or 'send an email'
June 20, 2011, 06:58:04 am
I have tested locally and seems to be working fine

Kurund
Found this reply helpful? Support CiviCRM

theMusician

  • I post occasionally
  • **
  • Posts: 48
  • Karma: 3
  • CiviCRM version: 4.0 and 4.0.1
  • CMS version: Drupal 7.0
  • MySQL version: MySQL 5.x
  • PHP version: 5.2
Re: Tokens not being inserted in CiviMail or 'send an email'
June 20, 2011, 08:41:39 am
It works for me too, running the latest versions of D7 and Civi.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Tokens not being inserted in CiviMail or 'send an email'
June 20, 2011, 12:57:24 pm
thanks - weird - thought it might be a browser issue then but problem is safari, chrome and firefox - back to digging.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Tokens not being inserted in CiviMail or 'send an email'
June 20, 2011, 04:13:49 pm
Looks like it is a WYSIWYG related problem - works for me with CK Editor but not with TinyMCE - will investigate
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

torrance123

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 3
  • CiviCRM version: 4.0
  • CMS version: Drupal 7
  • MySQL version: 5.0.91
  • PHP version: 5.3.3
Re: Tokens not being inserted in CiviMail or 'send an email'
June 20, 2011, 04:47:09 pm
Hi, yes it is a incompatibility with tinymce.

it's borking in this function:

Code: [Select]
function tokenReplHtml ( )
    {
        var token2     = cj("#token2").val( )[0];
        var editor     = "drupalwysiwyg";
        if ( editor == "tinymce" ) {
            cj('#'+ html_message).tinymce().execCommand('mceInsertContent',false, token2);
        } else if ( editor == "joomlaeditor" ) {
            tinyMCE.execCommand('mceInsertContent',false, token2);
            var msg       = document.getElementById(html_message).value;
            var cursorlen = document.getElementById(html_message).selectionStart;
            var textlen   = msg.length;
            document.getElementById(html_message).value = msg.substring(0, cursorlen) + token2 + msg.substring(cursorlen, textlen);
            var cursorPos = (cursorlen + token2.length);
            document.getElementById(html_message).selectionStart = cursorPos;
            document.getElementById(html_message).selectionEnd   = cursorPos;
            document.getElementById(html_message).focus();           
        } else if ( editor == "ckeditor" ) {
            oEditor = CKEDITOR.instances[html_message];
            oEditor.insertHtml(token2.toString() );
        } else {
            function tokenReplHtml ( )
    {
        var token2     = cj("#token2").val( )[0];
        var editor     = "drupalwysiwyg";
        if ( editor == "tinymce" ) {
            cj('#'+ html_message).tinymce().execCommand('mceInsertContent',false, token2);
        } else if ( editor == "joomlaeditor" ) {
            tinyMCE.execCommand('mceInsertContent',false, token2);
            var msg       = document.getElementById(html_message).value;
            var cursorlen = document.getElementById(html_message).selectionStart;
            var textlen   = msg.length;
            document.getElementById(html_message).value = msg.substring(0, cursorlen) + token2 + msg.substring(cursorlen, textlen);
            var cursorPos = (cursorlen + token2.length);
            document.getElementById(html_message).selectionStart = cursorPos;
            document.getElementById(html_message).selectionEnd   = cursorPos;
            document.getElementById(html_message).focus();           
        } else if ( editor == "ckeditor" ) {
            oEditor = CKEDITOR.instances[html_message];
            oEditor.insertHtml(token2.toString() );
        } else {
            var msg       = document.getElementById(html_message).value;
            var cursorlen = document.getElementById(html_message).selectionStart;
            var textlen   = msg.length;
            document.getElementById(html_message).value = msg.substring(0, cursorlen) + token2 + msg.substring(cursorlen, textlen);
            var cursorPos = (cursorlen + token2.length);
            document.getElementById(html_message).selectionStart = cursorPos;
            document.getElementById(html_message).selectionEnd   = cursorPos;
            document.getElementById(html_message).focus();
        }

        if ( isMailing ) {
             verify();
        }
    }
add:1191Uncaught TypeError: Cannot read property 'value' of null
            var cursorlen = document.getElementById(html_message).selectionStart;
            var textlen   = msg.length;
            document.getElementById(html_message).value = msg.substring(0, cursorlen) + token2 + msg.substring(cursorlen, textlen);
            var cursorPos = (cursorlen + token2.length);
            document.getElementById(html_message).selectionStart = cursorPos;
            document.getElementById(html_message).selectionEnd   = cursorPos;
            document.getElementById(html_message).focus();
        }

        if ( isMailing ) {
             verify();
        }
    }

Namely at the line "document.getElementById(html_message).value;", where the value of var html_message is "html_message" and this id doesn't exist. If it is meant to be grabbing the text-area, then the id it *should* be searching for is "edit-html-message-value".

Osvaldo

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • Open source rocks!
Re: Tokens not being inserted in CiviMail or 'send an email'
October 29, 2012, 02:32:54 pm
When we try to insert a token into the content area while the full html input format is enabled, it doesn't work. If we disable 'rich text' or use a plain input format; then tokens get inserted.

We're using Drupal 6.22, CiviCRM 4.1.5 and the Wysiwyg, IMCE setup with the CKeditor library. We've set CiviCRM to use the default drupal editor.
Osvaldo Gomez
Upleaf LLC

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Tokens not being inserted in CiviMail or 'send an email'

This forum was archived on 2017-11-26.