Forum

Thread tagged as: Problem, Forms

PerchSystem Variables not rendering in perch form

I have a form with two select fields whose option values I set up to editable via the CMS. The form (contact.html) was part of a contact us page (see contact.php below) and uses perch system variables to insert the values from select-options template (select-options.html). This was all working fine, but now the form is no longer rendering the options added in the CMS. I have included the diagnostic information at the bottom. Can anyone find what is wrong?

perch_content_create('Event Type', array(
     'template' => 'select-options.html',
 ));
perch_content_create('Guest Numbers', array(
    'template' => 'select-options.html',
));
...
<?php PerchSystem::set_var('event_type', perch_content_custom('Event Type', [ ], true)); ?>
<?php PerchSystem::set_var('guest_no', perch_content_custom('Guest Numbers', [ ], true)); ?>
<?php perch_form('contact.html'); ?>
....

contact.php


<perch:form id="contact" method="post" app="perch_forms" class="..."> ... <p class="..."> <perch:label for="guests" class="..."> <perch:input type="select" options="<perch:forms id='guest_no' />" id="guests" label="Number of guests" class="..." /> </perch:label> </p> <p class="..."> <perch:label for="type" class="..."> <perch:input type="select" options="<perch:forms id='event_type' />" id="type" label="Event type" class="..." /> </perch:label> </p> ... </perch:form>

contact.html

<perch:content id="default_option" type="text" label="Default Option Text" />|<perch:content id="default_option" format="LC" />
<perch:repeater id="select_options" label="Select Options">
    ,<perch:content id="option" type="text" label="Select option"/>|<perch:content id="option" format="LC" />
</perch:repeater>

select-options.html

Perch: 3.1.2
Production mode: Production (100)
Installed apps: content (3.1.2), assets (3.1.2), categories (3.1.2), perch_blog (5.6.1), perch_events (1.9.5), perch_forms (1.12), perch_gallery (2.8.9), perch_twitter (3.6.2)
DB driver: PDO
DB tables: perch3_blog_authors (1), perch3_blog_comments (0), perch3_blog_index (416), perch3_blog_posts (4), perch3_blog_posts_to_tags (0), perch3_blog_sections (2), perch3_blog_tags (0), perch3_blog_webmention_queue (0), perch3_blogs (1), perch3_categories (2), perch3_category_counts (2), perch3_category_sets (1), perch3_content_index (1467), perch3_content_items (335), perch3_content_regions (79), perch3_events (0), perch3_events_categories (0), perch3_events_to_categories (0), perch3_forms (1), perch3_forms_responses (15), perch3_gallery_albums (1), perch3_gallery_image_versions (24), perch3_gallery_images (4), perch3_menu_items (13), perch3_navigation (2), perch3_navigation_pages (17), perch3_page_templates (17), perch3_pages (39), perch3_resource_log (1160), perch3_resource_tags (2), perch3_resources (249), perch3_resources_to_tags (8), perch3_settings (33), perch3_twitter_scheduled_tweets (0), perch3_twitter_settings (2), perch3_twitter_tweets (0), perch3_user_passwords (1), perch3_user_privileges (47), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (1)
Users: 1
App runtimes:
<?php
    $apps_list = [
        'perch_blog',
        'perch_events',
        'perch_forms',
        'perch_twitter',
        'perch_gallery',
    ];
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins), publish_posts (1 mins), process_webmentions (1 mins)
Scheduled tasks for perch_twitter: post_tweets (1 mins)
Editor plug-ins:
H1: 66e1d2dfb44f88717e51ec3424472a2f
L1: dabeb78f7e18e1ed8e8819b2b659c557
F1: 3b606135b33e6a102526838f4152a807
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 0
content_collapseList: 1
lang: en-gb
installedAt: 3.1.2
update_3.1.2: done
latest_version:
on_sale_version: 3.1.4
perch_blog_update: 5.6
perch_blog_post_url: /blog/post.php?s={postSlug}
headerScheme: light
perch_blog_site_name:
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
dashboard: 0
sidebar_back_link: 0
hide_pwd_reset: 0
keyboardShortcuts: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
content_skip_region_list: 0
assets_restrict_buckets: 0
perch_blog_comment_notify: 0
perch_blog_webmention_tx: 0
perch_blog_webmention_rx: 0
logoPath: /cms/resources/logo.png
perch_events_update: 1.8
perch_twitter_update: 3.5
perch_gallery_update: 2.8.5
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: cap_admin
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: admin_capability
PERCH_DB_PREFIX: perch3_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: jamesh@thirdfloordesign.co.uk
PERCH_EMAIL_FROM_NAME: James Holmes
PERCH_LOGINPATH: /cms
PERCH_PATH: /var/www/vhosts/thirdfloordigital.net/capability.thirdfloordigital.net/cms
PERCH_CORE: /var/www/vhosts/thirdfloordigital.net/capability.thirdfloordigital.net/cms/core
PERCH_RESFILEPATH: /var/www/vhosts/thirdfloordigital.net/capability.thirdfloordigital.net/cms/resources
PERCH_RESPATH: /cms/resources
PERCH_TEMPLATE_FILTERS: 1
PERCH_GMAPS_API_KEY: AIzaSyCnDCyPw1L43hKlrK5huoShs-DRCRV5ghA
PERCH_YOUTUBE_API_KEY: AIzaSyDypfC97nK_yTd0dFkE0MfqPPNBfRGdpHo
PERCH_DEBUG:
PERCH_HTML5: 1
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_ASSET_VERSION: 6738d5d5f5664f7c5e34
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /var/www/vhosts/thirdfloordigital.net/capability.thirdfloordigital.net/cms/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_XHTML_MARKUP:
PERCH_RWD: 1
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_DEFAULT_BUCKET: default
PERCH_TRANSLATION_ASSIST:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_PRIV_ASSIST:
PERCH_CUSTOM_EDITOR_CONFIGS:
PERCH_ENABLE_EXIF: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
Hosting settings
PHP: 5.4.13
Zend: 2.4.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: 5.5.30
MySQL server: 5.5.30
Free disk space: 8.75 GB
Extensions: Core, date, ereg, libxml, openssl, pcre, zlib, bz2, calendar, ctype, hash, filter, ftp, gettext, gmp, SPL, iconv, pcntl, readline, Reflection, session, standard, shmop, SimpleXML, sockets, mbstring, tokenizer, xml, cgi-fcgi, curl, dom, fileinfo, gd, imagick, imap, json, ldap, exif, mcrypt, mysql, mysqli, odbc, PDO, pdo_mysql, PDO_ODBC, pdo_sqlite, Phar, snmp, sqlite3, wddx, xmlreader, xmlrpc, xmlwriter, xsl, zip, mhash, ionCube Loader
GD: Yes
ImageMagick: Yes
PHP max upload size: 128M
PHP max form post size: 8M
PHP memory limit: 128M
Total max uploadable file size: 8M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
PATH: /sbin:/usr/sbin:/bin:/usr/bin
PP_CUSTOM_PHP_INI: /var/www/vhosts/system/capability.thirdfloordigital.net/etc/php.ini
PP_CUSTOM_PHP_CGI_INDEX: fastcgi
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
REQUEST_URI: /cms/core/settings/diagnostics/?extended
QUERY_STRING: extended
REQUEST_METHOD: GET
SERVER_PROTOCOL: HTTP/1.0
GATEWAY_INTERFACE: CGI/1.1
REMOTE_PORT: 45962
SCRIPT_FILENAME: /var/www/vhosts/thirdfloordigital.net/capability.thirdfloordigital.net/cms/core/settings/diagnostics/index.php
SERVER_ADMIN: root@localhost
DOCUMENT_ROOT: /var/www/vhosts/thirdfloordigital.net/capability.thirdfloordigital.net
REMOTE_ADDR: 82.35.54.156
SERVER_PORT: 80
SERVER_ADDR: 205.186.165.244
SERVER_NAME: capability.thirdfloordigital.net
SERVER_SOFTWARE: Apache
SERVER_SIGNATURE: <address>Apache Server at capability.thirdfloordigital.net Port 80</address>
HTTP_COOKIE: cmsa=1; PHPSESSID=fpahfq49vggacejtn36hkrccr4
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.9
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_REFERER: https://capability.thirdfloordigital.net/cms/core/settings/diagnostics/
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
HTTP_DNT: 1
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_CONNECTION: close
HTTP_X_ACCEL_INTERNAL: /internal-nginx-static-location
HTTP_X_FORWARDED_FOR: 82.35.54.156
HTTP_X_REAL_IP: 82.35.54.156
HTTP_HOST: capability.thirdfloordigital.net
UNIQUE_ID: XDNMs826pfQAADNJCokAAAAC
FCGI_ROLE: RESPONDER
PHP_SELF: /cms/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1546865843.8487
REQUEST_TIME: 1546865843
Neal Hanson

Neal Hanson 0 points

  • 2 years ago

p.s. When I print_r all the variables (i.e. PerchSystem::get_vars). I get.

Array ( [event_type] => Occasion / Event type|occasion / event type ,Corporate Events|corporate events ,Conference/Seminar|conference/seminar ,Trade Show|trade show ,Press Conference|press conference ,Product Launch|product launch ,Annual Shareholder Meeting|annual shareholder meeting ,Wedding|wedding ,Birthday Party|birthday party ,Family Event|family event [guest_no] => Number of guests|number of guests ,0-10|0-10 ,11-25|11-25 ,26-50|26-50 ,51-100|51-100 ,100+|100+ )

So the variables are present.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You're using the wrong type of quotes:

<perch:forms id='guest_no' />