Forum

Thread tagged as: Problem, Error, Field-Types

Required validation not working on images

Hi,

I've noticed while developing a client site that I am able to save a region despite not adding any images to a required field. Is there anything obvious I am missing in my template that could be causing this?

<perch:content id="image_portrait" type="image" label="Photo" bucket="content" crop="true" width="316" height="316" required="true" suppress="true" divider-before="Images" />
<perch:content id="image_portrait" type="image" bucket="content" crop="true" width="316" height="175" suppress="true" />
<perch:content id="image_landscape" type="image" label="Mobile photo" bucket="content" crop="true" width="316" height="175" suppress="true" help="Optional. Mobile devices use a landscape crop of the above image, use this field to override with a custom image." />

Region Code:

perch_content_create('Principles', [
    'template'    => 'page/posters.html',
    'multiple'     => true,
    'edit-mode' => 'listdetail'
]);

perch_content('Principles');

Diagnostics:

Perch Runway: 2.8.31
Production mode: Development (10)
Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31), perch_forms (1.8.3), perch_shop_orders (1.0.8), perch_shop_products (1.0.8), perch_shop (1.0.8), perch_members (1.5), root_artithmetic (1), root_breadcrumbs (1.0)
DB driver: PDO
DB tables: perch2_backup_plans (0), perch2_backup_resources (0), perch2_backup_runs (0), perch2_categories (26), perch2_category_counts (0), perch2_category_sets (3), perch2_collection_index (0), perch2_collection_items (0), perch2_collection_revisions (0), perch2_collections (0), perch2_content_index (679), perch2_content_items (112), perch2_content_regions (23), perch2_forms (0), perch2_forms_responses (0), perch2_members (4), perch2_members_forms (1), perch2_members_member_tags (0), perch2_members_sessions (1), perch2_members_tags (0), perch2_navigation (4), perch2_navigation_pages (10), perch2_page_routes (4), perch2_page_templates (22), perch2_pages (23), perch2_resource_log (164), perch2_resource_tags (0), perch2_resources (46), perch2_resources_to_tags (0), perch2_settings (27), perch2_shop_addresses (18), perch2_shop_admin_index (32), perch2_shop_brands (6), perch2_shop_cart (13), perch2_shop_cart_data (21), perch2_shop_cart_items (8), perch2_shop_countries (250), perch2_shop_currencies (152), perch2_shop_customers (5), perch2_shop_emails (1), perch2_shop_index (388), perch2_shop_option_values (15), perch2_shop_options (1), perch2_shop_order_items (9), perch2_shop_order_promotions (3), perch2_shop_order_statuses (9), perch2_shop_orders (4), perch2_shop_orders_meta (1), perch2_shop_product_files (0), perch2_shop_product_option_values (7), perch2_shop_product_options (2), perch2_shop_product_tags (0), perch2_shop_products (11), perch2_shop_promotions (1), perch2_shop_search (4), perch2_shop_shipping_zone_countries (1), perch2_shop_shipping_zones (1), perch2_shop_shippings (1), perch2_shop_tax_exhibits (16), perch2_shop_tax_group_rates (1), perch2_shop_tax_groups (1), perch2_shop_tax_locations (1), perch2_shop_tax_rates (1), perch2_shop_variants (7), perch2_user_passwords (0), perch2_user_privileges (68), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (1)
Users: 1
App runtimes:
<?php
$apps_list = [
    'content',
    'categories',
    'perch_forms',
    'perch_members',
    'perch_shop',
    'root_breadcrumbs',
    'root_arithmetic'
];
Editor plug-ins: markitup, redactor
H1: d35e3649dcd083be9a94b6f88fc73692
L1: 48729459af5dd8f62aba38d76e6c3aa1
F1: 2edba60ed1f613d6dd804feb202456a2
headerColour: #23AE9F
content_singlePageEdit: 1
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.31: done
perch_shop_update: 1.0.8
headerScheme: dark
update_runway_2.8.31: done
latest_version: 2.8.15
on_sale_version: 2.8.31
dashboard: 1
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
helpURL: mailto:design@rootstudio.co.uk
logoPath: /admin/resources/little-puds-and-co-logo-with-stars.png
perch_members_login_page: /members/login.php?r={returnURL}
perch_shop_price_tax_mode: exc
perch_shop_trade_price_tax_mode: exc
perch_shop_site_url: https://littlepudsandco.com
perch_shop_product_url: /shop/products/{slug}
perch_shop_default_currency: 47
perch_shop_reporting_currency: 47
perch_shop_invoice_number_format: Order %d
perch_members_update: 1.4
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_SITEPATH: /Users/James/Repositories/Little Puds/Little-Puds-Co-Core-site/build
PERCH_SCHEDULE_SECRET: LNaEOpVMTcbvx8aZ
PERCH_DB_USERNAME: root
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: puds_perch
PERCH_DB_PREFIX: perch2_
PERCH_DEBUG: 1
PERCH_PRODUCTION_MODE: 10
PERCH_EMAIL_FROM: james@rootstudio.co.uk
PERCH_EMAIL_FROM_NAME: Root Studio
PERCH_LOGINPATH: /admin
PERCH_PATH: /Users/James/Repositories/Little Puds/Little-Puds-Co-Core-site/build/admin
PERCH_CORE: /Users/James/Repositories/Little Puds/Little-Puds-Co-Core-site/build/admin/core
PERCH_RESFILEPATH: /Users/James/Repositories/Little Puds/Little-Puds-Co-Core-site/build/admin/resources
PERCH_RESPATH: /admin/resources
PERCH_HTML5: 1
PERCH_TZ: UTC
PERCH_RUNWAY: 1
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: /Users/James/Repositories/Little Puds/Little-Puds-Co-Core-site/build/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
PERCH_SHOP_VERSION: 1.0.8
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: textile
HOSTING SETTINGS

PHP: 5.6.25
Zend: 2.6.0
OS: Darwin
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
MySQL server: 5.6.28
Free disk space: 401.80 GB
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, SPL, iconv, intl, json, ldap, mbstring, session, standard, mysqlnd, mysqli, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, Reflection, mysql, SimpleXML, soap, sockets, exif, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, cgi-fcgi, imap, gettext, mcrypt, pgsql, pdo_pgsql, mhash, xdebug
GD: Yes
ImageMagick: No
PHP max upload size: 32M
PHP max form post size: 32M
PHP memory limit: 128M
Total max uploadable file size: 32M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
PHP_FCGI_CHILDREN: 4
PWD: /Applications/MAMP/fcgi-bin
PHP_FCGI_MAX_REQUESTS: 200
__CF_USER_TEXT_ENCODING: 0x1F5:0x0:0x2
ORIG_SCRIPT_NAME: /fcgi-bin/php5.6.25.fcgi
ORIG_PATH_TRANSLATED: /Users/James/Repositories/Little Puds/Little-Puds-Co-Core-site/build/admin/core/settings/diagnostics/index.php
ORIG_PATH_INFO: /admin/core/settings/diagnostics/index.php
ORIG_SCRIPT_FILENAME: /Applications/MAMP/fcgi-bin/php5.6.25.fcgi
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
REQUEST_URI: /admin/core/settings/diagnostics/?extended
QUERY_STRING: extended
REQUEST_METHOD: GET
SERVER_PROTOCOL: HTTP/1.1
GATEWAY_INTERFACE: CGI/1.1
REDIRECT_URL: /admin/core/settings/diagnostics/index.php
REDIRECT_QUERY_STRING: extended
REMOTE_PORT: 51693
SCRIPT_FILENAME: /Users/James/Repositories/Little Puds/Little-Puds-Co-Core-site/build/admin/core/settings/diagnostics/index.php
SERVER_ADMIN: you@example.com
DOCUMENT_ROOT: /Users/James/Repositories/Little Puds/Little-Puds-Co-Core-site/build
REMOTE_ADDR: ::1
SERVER_PORT: 80
SERVER_ADDR: ::1
SERVER_NAME: little-puds.local
SERVER_SOFTWARE: Apache
PATH: /usr/bin:/bin:/usr/sbin:/sbin
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-gb
HTTP_REFERER: https://little-puds.local/admin/core/settings/diagnostics/
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_CONNECTION: keep-alive
HTTP_COOKIE: _ga=GA1.2.1567848080.1471433931; __ar_v4=%7COMJFB4T7FJDTFPE4DEGNKB%3A20160930%3A1%7CTJITBEHNGNCGDHTCVQNWH3%3A20160930%3A1%7CTVE67VTYJBEYXFJHCDWVIL%3A20160930%3A1; PHPSESSID=5e18b9ed09acfac09887d60046d896b6; p_m=; cmsa=1
HTTP_HOST: little-puds.local
REDIRECT_STATUS: 200
REDIRECT_HANDLER: php-fastcgi
FCGI_ROLE: RESPONDER
PHP_SELF: /admin/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1475484680.81
REQUEST_TIME: 1475484680
argc: 1
James Wigger

James Wigger 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

That's right, validation doesn't take effect on images currently.

Is this planned in a future update? I am sure it used to work - was this a change made with the assets panel update or more recently? We have noticed a few clients recently missing out images in regions that really do need to have images set - such as banners / hotlinks etc.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, it's something we'll take a look at.

Awesome, thank you Rachel and Drew for the replies.