Hello! I am trying to upload a PDF to a files field within a structure field and I get this error:
“The field “organizationanddocumentation%2Borganizationanddocumentationurl” could not be found”
I have uploaded PDFs successfully into either structure before. Why does it not work now?
Blueprint:
title: About
columns:
sidebar:
width: 1/3
sections:
details:
type: fields
fields:
organizationanddocumentation:
label: Organization and documentation
type: structure
fields:
organizationanddocumentationtext:
label: Text
type: writer
organizationanddocumentationurl:
label: PDF
type: files
financialstatements:
label: Financial Statements
type: structure
fields:
financialstatementstext:
label: Text
type: writer
financialstatementsurl:
label: PDF
type: files
main:
width: 2/3
sections:
content:
type: fields
fields:
text:
type: blocks
label: Content
Template:
<?php
$currentLang = $kirby->language()->code();
$aboutOrganization = ($currentLang === 'is') ? 'Skipulag og skjöl' : 'Organization and documentation';
$aboutFinancial = ($currentLang === 'is') ? 'Ársreikningar' : 'Financial statements';
?>
<?php snippet('header') ?>
<div class="separator separator-1"></div>
<section class="about technical-details">
<div class="technical-details-content">
<div class="organization-and-documentation">
<p><?php echo $aboutOrganization; ?></p>
<?php
// Fetch organization and documentation items
$items = $page->organizationanddocumentation()->toStructure();
foreach ($items as $item):
// Check if the URL field is not empty
if (!$item->organizationanddocumentationurl()->isEmpty()):
// Fetch the first file from the organization and documentation URL
$file = $item->organizationanddocumentationurl()->toFiles()->first();
if ($file): // Check if the file exists
?>
<a href="<?= $file->url() ?>" target="_blank"><?= $item->organizationanddocumentationtext()->kirbytextinline() ?></a>
<?php
endif;
endif;
endforeach;
?>
</div>
<div class="financial-statements">
<p><?= html($aboutFinancial) ?></p>
<?php
// Fetch financial statements items
$items = $page->financialstatements()->toStructure();
foreach ($items as $item):
// Check if the URL field is not empty
if (!$item->financialstatementsurl()->isEmpty()):
// Fetch the first file from the financial statements URL
$file = $item->financialstatementsurl()->toFiles()->first();
if ($file): // Check if the file exists
?>
<a href="<?= $file->url() ?>" target="_blank"><?= $item->financialstatementstext()->kirbytextinline() ?></a>
<?php
endif;
endif;
endforeach;
?>
</div>
</div>
</section>
<div class="separator separator-2"></div>
<article class="about">
<div class="article-content">
<.h2 class="headline-text"> <?= $page->title() ?> </h2>
<div class="article-text main-body-text"><?= $page->text()->toBlocks() ?></div>
</div>
</article>
<?php snippet('footer') ?>
Kirby version info:
"info": {
"kirby": "4.3.0",
"php": "8.3.8",
"server": "Apache/2.4.59 (Debian)",
"license": "Kirby Basic",
"languages": [
"en",
"is"
]
},



