diff --git a/code/model/recipients/UserDefinedForm_EmailRecipient.php b/code/model/recipients/UserDefinedForm_EmailRecipient.php index 5348b7e..07d3d75 100644 --- a/code/model/recipients/UserDefinedForm_EmailRecipient.php +++ b/code/model/recipients/UserDefinedForm_EmailRecipient.php @@ -261,10 +261,7 @@ class UserDefinedForm_EmailRecipient extends DataObject ->addExtraClass('toggle-html-only'), TextareaField::create('EmailBody', _t('UserDefinedForm.EMAILBODY', 'Body')) ->addExtraClass('toggle-plain-only'), - LiteralField::create( - 'EmailPreview', - '
' . $preview . '
' - ) + LiteralField::create('EmailPreview', $preview) )); $fields->fieldByName('Root.EmailContent')->setTitle(_t('UserDefinedForm_EmailRecipient.EMAILCONTENTTAB', 'Email Content')); diff --git a/javascript/Recipient.js b/javascript/Recipient.js index 0bae6bf..0e97c57 100644 --- a/javascript/Recipient.js +++ b/javascript/Recipient.js @@ -5,12 +5,11 @@ (function ($) { $(document).ready(function () { + var sendPlain = $('input[name="SendPlain"]'); var recipient = { // Some fields are only visible when HTML email are being sent. updateFormatSpecificFields: function () { - var sendPlainChecked = $('#SendPlain') - .find('input[type="checkbox"]') - .is(':checked'); + var sendPlainChecked = sendPlain.is(':checked'); $(".field.toggle-html-only")[sendPlainChecked ? 'hide' : 'show'](); $(".field.toggle-plain-only")[sendPlainChecked ? 'show' : 'hide'](); @@ -27,7 +26,7 @@ } }); - $('#SendPlain').entwine({ + sendPlain.entwine({ onchange: function () { recipient.updateFormatSpecificFields(); }