Forum

Thread tagged as: Problem, Error, Redactor

Redactor regions in repeaters do not save content

Hi,

Something I've noticed as I've been transferring content to a new site is that when multiple redactor instances are created using a repeater then it does not always save the content of the editor. It doesn't even keep the content between POST requests.

Once the page has been saved and content re-entered it will save fine. There are no errors in the debug log, the update queries simply do not include the content from the redactor region. The plain text field retains the information fine. There are no console errors I can see either.

Possible triggers could be when making multiple repeater rows (EG, copying 3 FAQs would mean I would be clicking 'Add Another' 3 times then copying the content, then saving).

I've noticed this happening with redactor I and redactor II.

Diagnostics:

Perch: 2.8.30
Production mode: Staging (50)
Installed apps: content (2.8.30), assets (2.8.30), categories (2.8.30), perch_blog (5.0), perch_forms (1.8.3), jw_locator (1.1.0), jw_translations (1)
DB driver: PDO
DB tables: perch2_blog_authors (1), perch2_blog_comments (0), perch2_blog_index (1636), perch2_blog_posts (76), perch2_blog_posts_to_tags (0), perch2_blog_sections (1), perch2_blog_tags (0), perch2_blogs (1), perch2_categories (0), perch2_category_counts (0), perch2_category_sets (2), perch2_content_index (4031), perch2_content_items (529), perch2_content_regions (74), perch2_forms (1), perch2_forms_responses (3), perch2_jw_locator_failed_jobs (0), perch2_jw_locator_locations (2), perch2_jw_locator_markers (2), perch2_navigation (2), perch2_navigation_pages (11), perch2_page_templates (16), perch2_pages (27), perch2_resource_log (407), perch2_resource_tags (1), perch2_resources (194), perch2_resources_to_tags (6), perch2_scheduled_tasks (2), perch2_settings (26), perch2_user_passwords (1), perch2_user_privileges (43), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (1)
Users: 1
App runtimes:
<?php
$apps_list = [
    'content',
    'categories',
    'perch_blog',
    'perch_forms',
    'jw_translations',
    'jw_locator'
];
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Scheduled tasks for jw_locator: geocode_location_batch (10 mins)
Editor plug-ins: markitup, redactor
H1: 4d867dd4aca7291853bc21318a735765
L1: c5835d8fb375147b3ac426c4c2e79904
F1: 2edba60ed1f613d6dd804feb202456a2
headerColour: #4A96D2
content_singlePageEdit: 1
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.30: done
latest_version: 2.8.15
on_sale_version: 2.8.30
headerScheme: dark
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
logoPath: /admin/resources/ts-logo2x.png
helpURL: mailto:design@rootstudio.co.uk
perch_blog_update: 5.0.1
perch_blog_post_url: /news/{postSlug}
jw_locator_batch_size: 25
jw_locator_google_api_key:
perch_blog_site_name:
perch_blog_slug_format: {postID}-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
perch_blog_comment_notify: 0
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_TZ: UTC
PERCH_EMAIL_FROM: james@rootstudio.co.uk
PERCH_EMAIL_FROM_NAME: Root Studio
PERCH_LOGINPATH: /admin
PERCH_PATH: /home/stagethis/public_html/totalsweet/admin
PERCH_CORE: /home/stagethis/public_html/totalsweet/admin/core
PERCH_RESFILEPATH: /home/stagethis/public_html/totalsweet/admin/resources
PERCH_RESPATH: /admin/resources
PERCH_HTML5: 1
PERCH_SCHEDULE_SECRET: XXXXXXXX
PERCH_DB_USERNAME: stagethi_ts_user
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: stagethi_totalsweet_uk
PERCH_DB_PREFIX: perch2_
PERCH_DEBUG: 1
PERCH_PRODUCTION_MODE: 50
PERCH_RUNWAY:
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /home/stagethis/public_html/totalsweet/admin/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
HOSTING SETTINGS

PHP: 5.6.19
Zend: 2.6.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
MySQL server: 5.5.50-cll
Free disk space: 85.31 GB
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, calendar, ctype, curl, dom, fileinfo, filter, ftp, gd, hash, iconv, SPL, json, mbstring, mcrypt, session, mysql, standard, Phar, posix, Reflection, mysqlnd, SimpleXML, sockets, imap, tokenizer, xml, xmlreader, xmlwriter, cgi-fcgi, PDO, pdo_sqlite, imagick, pdo_mysql
GD: Yes
ImageMagick: Yes
PHP max upload size: 200M
PHP max form post size: 12M
PHP memory limit: 256M
Total max uploadable file size: 12M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
CONTEXT_DOCUMENT_ROOT: /home/stagethis/public_html/totalsweet
DOCUMENT_ROOT: /home/stagethis/public_html/totalsweet
GATEWAY_INTERFACE: CGI/1.1
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-us
HTTP_CONNECTION: keep-alive
HTTP_COOKIE: PHPSESSID=dbeb5a8193adefd3e5a9b9d09bc9358f; cmsa=1; _ga=GA1.2.700527772.1463496084
HTTP_HOST: totalsweet.rootstaging.uk
HTTP_REFERER: https://totalsweet.rootstaging.uk/admin/core/settings/diagnostics/
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17
PATH: /bin:/usr/bin
QUERY_STRING: extended
REDIRECT_STATUS: 200
REMOTE_ADDR: 81.130.131.129
REMOTE_PORT: 52974
REQUEST_METHOD: GET
REQUEST_SCHEME: http
REQUEST_URI: /admin/core/settings/diagnostics/?extended
SCRIPT_FILENAME: /home/stagethis/public_html/totalsweet/admin/core/settings/diagnostics/index.php
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
SERVER_ADDR: 162.251.83.56
SERVER_ADMIN: webmaster@totalsweet.rootstaging.uk
SERVER_NAME: totalsweet.rootstaging.uk
SERVER_PORT: 80
SERVER_PROTOCOL: HTTP/1.1
SERVER_SIGNATURE: <address>Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 Server at totalsweet.rootstaging.uk Port 80</address>
SERVER_SOFTWARE: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4
UNIQUE_ID: V395RaL7UzgAAGOLThgAAAAA
PHP_SELF: /admin/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1467971909.97
REQUEST_TIME: 1467971909
argc: 1

Region code:

<perch:content id="title" type="text" label="Title" size="xl" title="true" required="true" suppress="true" />

<header class="header-basic ">
    <h1 class="header-basic__title">
        <perch:content id="title" type="hidden" />
    </h1>
</header>

<perch:repeater id="sections" label="Text Blocks">
    <perch:content id="section_title" type="text" label="Title" size="xl" title="true" required="true" suppress="true" />
    <perch:content id="section_body" type="textarea" label="Content" html="true" editor="redactor" suppress="true" />

    <section class="collapsible" data-collapse>
        <h1 class="collapsible__title <perch:if exists="perch_item_first">open</perch:if>">
            <perch:content id="section_title" type="hidden" />
        </h1>
        <div class="collapsible__content rich-text">
            <perch:content id="section_body" type="hidden" html="true" />
        </div>
    </section>
</perch:repeater>

Thanks

James Wigger

James Wigger 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Using an editor in a repeater is probably a red flag that something isn't structured well. Repeaters aren't intended for heavy content.

I'd agree that repeaters shouldn't be for large regions, but at times it seems unavoidable, and in this instance it only contains a single text field and an editor region which I wouldn't consider large.

It could be a standard textarea field but the client wishes to have formatting control over the text within each FAQ section.

Is there anything you would suggest as a way of formatting this region?

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you don't want to use Markdown, then that's probably your only option. I'll see if I can get a chance to look at what Redactor is doing in that scenario.

+1 on this exact issue, only the first repeater gets saved when the repeater contains a Redactor field.