Can not publish page directly
Permalink
I create a page with composer and add content and an image (I show that image also in pagelist). Everything works great. But when I edit the page and create an extra block I cannot directly publish the page. It tells me "the field productafbeelding is required" but the images already exists.
So then my only option is to save changes. Then I get the blue box "Page is waiting for approval.." with the button "Approve version". When I click that the page gets approved.
Any Idea what goes wrong. Or how to fix this?
So then my only option is to save changes. Then I get the blue box "Page is waiting for approval.." with the button "Approve version". When I click that the page gets approved.
Any Idea what goes wrong. Or how to fix this?
Thank you for your reply. But in this case the thumbnail is not empty (because I uploaded it myself) but I still get the error when trying to edit (not with composer but in the page itself) and publish the page again.
So I like to know how I get the error. Is there something wrong with my code?
If not how can I combine your code with mine? (where to put the else?)
I use the following code:
So I like to know how I get the error. Is there something wrong with my code?
If not how can I combine your code with mine? (where to put the else?)
I use the following code:
Anyone else getting this problem? Getting this in all my projects using composer in combination with an image. Very annoying!
Do you have a controller for this page type which checks required fields? If so can you show us the code?
My steps:
1) Create image attribute (thumbnail) (dashboard/pages/attributes)
2) Add Image to page form (dashboard/pages/types/form)
* and select that the image is required in form image option)
3) Call for image attribute in template and load different thumbnail preset sizes)
4) Add page (with composer) and insert image an data (works ok)
5) Add extra element outside composer to the page just created (I get an alert that the field "Afbeelding" is required)
6) For now is just save, and then I get the blue box in right corner thats say's to approve the page. That works.
1) Create image attribute (thumbnail) (dashboard/pages/attributes)
2) Add Image to page form (dashboard/pages/types/form)
* and select that the image is required in form image option)
3) Call for image attribute in template and load different thumbnail preset sizes)
<?php defined('C5_EXECUTE') or die("Access Denied.");?> <?php $this->inc('elements/header.php'); ?> <header class="headerwrapper"> <div class="container-fluid"> <div class="row"> <?php $this->inc('elements/nav.php'); ?> </div> </div> </header> <div class="headerimagevvp headerimgproject"> <?php $a= new Area ('headerimage'); $a->display($c); ?> <?php $img = $c->getAttribute('thumbnail'); ?> <?php if ($img): ?> <img class="blurimg" src="<?php echo ($img->getVersion()->getThumbnailURL('mainheader')) ?>"/>
Viewing 15 lines of 44 lines. View entire code block.
4) Add page (with composer) and insert image an data (works ok)
5) Add extra element outside composer to the page just created (I get an alert that the field "Afbeelding" is required)
6) For now is just save, and then I get the blue box in right corner thats say's to approve the page. That works.
This just checks if the attribute is empty, and if it is - put image.png as the value. Image.png would hypothetically be a 1px x 1px transparent png.