Related field not showing options in admin area
Hi,
I have two collections "Jobs" and "Team Members", I want to be able to assign team members to jobs. In my jobs template I am adding a related field, but in my jobs admin view the related field does not offer any options when I click on it.
The Jobs template is like so
<perch:content id="jobID" type="text" label="Job ID" help="Leave empty, only used by BroadBean" suppress="true" />
<perch:content id="jobRef" type="text" label="Job Reference" help="Reference as displayed on website" suppress="true" />
<perch:content id="jobTitle" type="text" label="Job Title" required="true" suppress="true" />
<!-- used to display category selection interface to the CMS page -->
<!-- job sector and sub sector -->
<perch:categories id="jobSector" label="Sector" set="sectors" required="true" suppress="true">
<perch:before>
<ul class="tags">
</perch:before>
<li><a href="<perch:category id="catPath" />"><perch:category id="catTitle" /></a></li>
<perch:after>
</ul>
</perch:after>
</perch:categories>
<!-- Region -->
<perch:categories id="jobRegion" label="Location" set="regions" required="true" suppress="true">
<perch:before>
<ul class="tags">
</perch:before>
<li><a href="<perch:category id="catPath" />"><perch:category id="catTitle" /></a></li>
<perch:after>
</ul>
</perch:after>
</perch:categories>
<perch:content id="jobDesc" type="textarea" label="Description" html="true" editor="redactor" suppress="true" />
<perch:related id="consultant" collection="Team Members" label="Consultant">
<p>
<perch:content id="teamMemberName" type="text" />
</p>
</perch:related>
<div class="row job-list-item">
<div class="col-md-10 col-sm-12">
<div class="article-text">
<h3><perch:content id="jobTitle" type="text" /></h3>
<perch:if exists="jobSalary">
<p>
<perch:content id="jobSalary" type="text" label="Job Salary" required="false" help="leave blank and select from drop down if not specified" />
</p>
</perch:if>
<p>
<perch:content id="salaryType" type="select" options="Negotiable,Competitive,On Application,Per Annum, Per Day, Per Month, Per Hour" label="Salary Type" required="false" help="Select type e.g Per Annum" />
</p>
<perch:categories id="jobSector">
<span style="display:block"><perch:category id="catTitle" type="text" /></span>
</perch:categories>
<perch:categories id="jobRegion">
<span style="display:block"><perch:category id="catTitle" type="text" /></span>
</perch:categories>
<a href="" class="btn btn-primary">Read more</a>
</div>
</div>
</div>
and the team member template like so:
<perch:content id="teamMemberName" type="text" label="Name" required="true" suppress="true" />
<perch:content id="teamMemberSlug" for="teamMemberName" type="slug" label="Slug" editable="true" indelible="true" suppress="true" help="Do not change this unless you know what you're doing!"/>
<perch:categories id="sectors" label="Assign to sector" set="sectors" display-as="checkboxes" />
<p><perch:content id="teamMemberName" type="text" /></p>
<img src="<perch:content type="image" id="teamMemberImage" label="Image" bucket="team" />" />
when I open a job in the admin view with debug on this is the message I get:
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='67efae88ed04f38f62608236f465484c' LIMIT 1
UPDATE perch2_users SET userHash='88097b26a99cc13d6a5194b5fd8a013a' WHERE userID='1'
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue, userID FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID, settingValue, userID
SELECT collectionID, collectionKey, collectionEditRoles FROM perch2_collections WHERE collectionInAppMenu=1 ORDER BY collectionOrder ASC
SELECT * FROM perch2_collections WHERE collectionID=7 LIMIT 1
SELECT ci.*, r.itemOrder, IF(r.itemLatestRev>r.itemRev,1,0) AS _has_draft FROM perch2_collection_items ci, perch2_collection_revisions r WHERE r.itemID=ci.itemID AND ci.collectionID='7' AND ci.itemRev=r.itemLatestRev AND ci.itemID=27 ORDER BY r.itemOrder ASC
SELECT * FROM perch2_collection_items ci, perch2_collection_revisions r WHERE r.itemID=ci.itemID AND ci.collectionID='7' AND ci.itemRev=r.itemRev AND ci.itemID=27
SELECT * FROM perch2_collection_items ci, perch2_collection_revisions r WHERE r.itemID=ci.itemID AND ci.collectionID='7' AND ci.itemRev=r.itemRev AND r.itemOrder > '1000' ORDER BY r.itemOrder LIMIT 1
SELECT * FROM perch2_collection_items ci, perch2_collection_revisions r WHERE r.itemID=ci.itemID AND ci.collectionID='7' AND ci.itemRev=r.itemRev AND r.itemOrder < '1000' ORDER BY r.itemOrder DESC LIMIT 1
Using template: \templates\content\_job.html
Form not posted or did not validate
SELECT itemRev, itemLatestRev FROM perch2_collection_revisions WHERE collectionID=7 AND itemID=27 LIMIT 1
SELECT * FROM perch2_categories c, perch2_category_sets s WHERE c.setID=s.setID AND s.setSlug='sectors' ORDER BY catTreePosition ASC
SELECT * FROM perch2_categories c, perch2_category_sets s WHERE c.setID=s.setID AND s.setSlug='regions' ORDER BY catTreePosition ASC
SELECT * FROM perch2_collections WHERE collectionKey='Team Members' LIMIT 1
SELECT * FROM perch2_collection_items ci, perch2_collection_revisions r WHERE r.itemID=ci.itemID AND ci.collectionID='5' AND ci.itemRev=r.itemRev ORDER BY r.itemOrder ASC
and finally a copy of my advanced diagnostics:
Perch Runway: 2.8.24
Production mode: Production (100)
Installed apps: content (2.8.24), assets (2.8.24), categories (2.8.24), perch_events (1.9.2), perch_forms (1.8.3), perch_members (1.2)
DB driver: PDO
DB tables: perch2_backup_plans (0), perch2_backup_resources (0), perch2_backup_runs (0), perch2_categories (14), perch2_category_counts (0), perch2_category_sets (3), perch2_collection_index (1066), perch2_collection_items (127), perch2_collection_revisions (25), perch2_collections (6), perch2_content_index (577), perch2_content_items (239), perch2_content_regions (45), perch2_events (1), perch2_events_categories (0), perch2_events_to_categories (0), perch2_forms (1), perch2_forms_responses (0), perch2_members (1), perch2_members_forms (1), perch2_members_member_tags (0), perch2_members_sessions (0), perch2_members_tags (4), perch2_navigation (2), perch2_navigation_pages (11), perch2_page_routes (0), perch2_page_templates (20), perch2_pages (24), perch2_resource_log (99), perch2_resource_tags (166), perch2_resources (99), perch2_resources_to_tags (392), perch2_settings (20), perch2_user_passwords (0), perch2_user_privileges (34), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (1)
Users: 1
App runtimes:
<?php
$apps_list = array(
'content',
'categories',
'perch_members',
'perch_forms',
'perch_events',
);
Scheduled tasks for perch_events: update_category_counts (60 mins)
Editor plug-ins: markitup, redactor
H1: 8e11a97cb12559d3e5fba92f6f0b9252
L1: 64a296d35511cc228b1186b18e460615
F1: dc1fef2ad0fcd9f943c02ebb43d85dbc
headerColour: #000000
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.8: done
perch_events_detail_url: /events/?event={eventSlug}
headerScheme: dark
update_runway_2.8.8: done
latest_version: 2.8.15
on_sale_version: 2.8.24
perch_members_login_page: /members/login.php?r={returnURL}
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
perch_events_update: 1.8
update_runway_2.8.24: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_SITEPATH: C:\wamp\www\<mysite>\perch\setup\runway\modes
PERCH_SCHEDULE_SECRET: uJUojsPZTiupMgyB
PERCH_DB_USERNAME: keyadmin
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: <mysite>
PERCH_DB_PREFIX: perch2_
PERCH_EMAIL_FROM: lee@getunified.co.uk
PERCH_EMAIL_FROM_NAME: Lee Goodman
PERCH_LOGINPATH: /perch
PERCH_PATH: C:\wamp\www\<mysite>\perch
PERCH_CORE: C:\wamp\www\<mysite>\perch\core
PERCH_RESFILEPATH: C:\wamp\www\<mysite>\perch\resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 1
PERCH_TZ: Europe/London
PERCH_DEBUG: 1
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: C:\wamp\www\<mysite>\perch\templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_SESSION_TIMEOUT_MINS: 20
HOSTING SETTINGS
PHP: 5.4.12
Zend: 2.4.0
OS: WINNT
SAPI: apache2handler
Safe mode: not detected
MySQL client: mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $
MySQL server: 5.6.12-log
Free disk space: 547.08 GB
Extensions: Core, bcmath, calendar, com_dotnet, ctype, date, ereg, filter, ftp, hash, iconv, json, mcrypt, SPL, odbc, pcre, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, openssl, SimpleXML, wddx, xml, xmlreader, xmlwriter, apache2handler, curl, fileinfo, gd, intl, mbstring, mysql, mysqli, Phar, pdo_mysql, pdo_sqlite, mhash, xdebug
GD: Yes
ImageMagick: No
PHP max upload size: 120M
PHP max form post size: 120M
PHP memory limit: 128M
Total max uploadable file size: 120M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
HTTP_HOST: <mysite>
HTTP_CONNECTION: keep-alive
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36
HTTP_REFERER: https://<mysite>/perch/core/settings/diagnostics/
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE: en-GB,en-US;q=0.8,en;q=0.6
HTTP_COOKIE: cmsa=1; PHPSESSID=fak0vovj6j2438dklf7bd30217
PATH: C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\nodejs\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files (x86)\Skype\Phone\;
SystemRoot: C:\WINDOWS
COMSPEC: C:\WINDOWS\system32\cmd.exe
PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
WINDIR: C:\WINDOWS
SERVER_SOFTWARE: Apache/2.4.4 (Win64) PHP/5.4.12
SERVER_NAME: <mysite>
SERVER_ADDR: 127.0.0.1
SERVER_PORT: 80
REMOTE_ADDR: 127.0.0.1
DOCUMENT_ROOT: c:/wamp/www/<mysite>
REQUEST_SCHEME: http
CONTEXT_DOCUMENT_ROOT: c:/wamp/www/<mysite>
SERVER_ADMIN: admin@example.com
SCRIPT_FILENAME: C:/wamp/www/<mysite>/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 8358
GATEWAY_INTERFACE: CGI/1.1
SERVER_PROTOCOL: HTTP/1.1
REQUEST_METHOD: GET
QUERY_STRING: extended
REQUEST_URI: /perch/core/settings/diagnostics/?extended
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
PHP_SELF: /perch/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1454164233.428
REQUEST_TIME: 1454164233
This is my first time using the related field but I have followed the instructions on the video posted by Drew and I can't see what I'm missing!
Many thanks
Lee
I looks like the data for the field is being requested:
How many items do you have in the Team Members collection?
Hi Drew,
There are 12 items in the Team Members collection.
Many thanks
If you run the query directly, does it return any results?
Hi Drew,
It returns all 12 rows in the SQL query. I tried adding a relationship to another collection and I get the same issue, i,e nothing returns as an option to select.
The categories are available to select in the admin area.
Many thanks
Lee
Do you get any errors in your browser console?
If you view source on the edit form, do you see any options?
HI Drew
No console errors, no options in the page source. I've also tried creating a new collection called team and pulling that through and again nothing. I've also tried pulling it through on a different template and again nothing.
The only thing I do notice in the debug message is "Form not posted or did not validate"
As mentioned before the SQL returns the rows, it's just not generating the options to select in the form.
Any further suggestions?
Many thanks
I've just tried it on the staging site, which is actually an older version of Runway (v2.8.8)
I created the jobs collection as it didn't exist on staging, and I used a template with only two fields like so:
The Team Members collection does exist but I get the same problem nothing being pulled through, only difference is I do get a few console errors.
They are 404's looking for the following:
The debug message is as follows:
Same "Form not posted or did not validate" message also.
This issue appears to have existed on the site for a while as the staging site has not been amended since the beginning of December last year. I'm running WAMP on my local but the staging site is on an Ubuntu server, diagnostics for server are:
Many thanks
Lee
Ok, I'm really confused now - is this the same issue as this thread?
https://forum.grabaperch.com/forum/01-14-2016-related-fields-not-available-in-admin-panel-list-view
However your demo video clearly shows you using related fields in the admin view as you would categories?
That missing file would cause the error, yes. Does it exist?
I've checked on both my local (latest version of Perch upgraded couple of days ago) and staging v2.8.8 and both the JS and CSS files referenced in the error are missing.
Hi Drew,
Just created the files (albeit empty) to clear the errors and no change.
Can I just clarify that the ability to pull related collection items into the admin view as per your video here exists?
https://grabaperch.com/features/content-relationships
as the thread here seems to imply otherwise?
https://forum.grabaperch.com/forum/01-14-2016-related-fields-not-available-in-admin-panel-list-view
The SQL queries generated by the debug message, when executed manually, on the DB returns the related collection so I'm assuming the functionality is in place.
I'm a little loathed to continue development until I get to the bottom of this as I don't want to lose any content.
Are you taking about the edit form or the listing page?
I'm talking about the edit form in the CMS
That other thread is talking about list view, I believe, so it's not related.
ah ok sorry - forget all that bit then. :-) I'm not seeing anything in the CMS despite all the above
Are you still running an old version of Runway, or have you updated?
I've updated my local to latest version, staging is v2.8.8 but I haven't updated as I wanted to test if the upgrade had spannered anything.
The same issue occurs on both environments. i.e 2.8.8 and latest build.
Ok. I'm not sure where to go next, really. Can you show me a screenshot?
Sorry Drew I will get round to posting this, I am having others issues at the moment (another thread)
Hi Drew,
Not sure what you need a screenshot of but here is the admin area with the inspector, as you can see the related field is in focus after clicking, there are no options. The HTML has not been populated with options either.