-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page can no longer be published after a page break with fields has been deleted #996
Comments
Thanks for reporting this issue. I had a go at replicating it on a stock-standard site, but didn't managed to. Can you share the logic you use to automatically add the SPAM protection field? |
@maxime-rainville I am having the same issue. To reproduce:
The error seems to stem from the fact the page is not published after a change (in this case deletion) is performed on a form field. |
function onBeforeWrite() {
if($this->owner->Fields()->count() > 0){
if(class_exists("SilverStripe\SpamProtection\EditableSpamProtectionField")){
$spam_check = false;
$fields = $this->owner->Fields();
$parent_class = "";
foreach ($fields as $field) {
$classname_check = $field->ClassName;
$parent_class = $field->ParentClass;
if($classname_check == "SilverStripe\SpamProtection\EditableSpamProtectionField"){
$spam_check = true;
}
}
if($spam_check !== true){
$id = $this->owner->ID;
if($id && !empty($parent_class)){
$spam = new EditableSpamProtectionField();
$spam->Name = $this->generateName();
$spam->ParentClass = $parent_class;
$spam->ParentID = $id;
$spam->write();
$spam->publishRecursive();
}
}
}
}
} This is the code I use for adding the spamfield. But when I remove the extension I still have the same problem with the forms. |
I tried replicating the steps described by @nicolas-cusan but didn't seem to get anywhere. Here's what I did. Can you tell me if I'm missing anything? https://youtu.be/msJb6kkccL4
I think we already have an issue for that. #975 |
It's similar to #975. But can you still publish the page after you delete one of the steps and does this happen with all the fields or only with the file upload field? In my case it happens with every field I add to the form. |
@maxime-rainville thank you for looking into it. Here ist the reproduction of the issue in a quick gif. |
@nicolas-cusan Any chance you could post that stack trace at the end of your GIF? |
@maxime-rainville Workaround. Unplublishing the page and then publish again sets the page back to “published” and gives no error ... maybe this can shine a light on the issue???? Issue occurs whenever a form field is deleted and you try to publish the form. |
@maxime-rainville This was my trace
|
@maxime-rainville could this be fluent-related? Just tested on a clean silverstripe 4.7.1 and Userforms 5.8.2 and all is working ok. After adding the fluent module. The issue is showing up |
I've commented on the ticket in the fluent module too, but this can be fixed in this module by using the archive action of the gridfield, instead of the delete action:
Could we change the Userforms gridfield to use archive rather than delete, or is there a reason for this? |
Notably the DetailForm doesn't allow delete - it uses unpublish & unpublish and archive. I'd suggest that this module should check if versioned is enabled, and use the Archive action when it is. For now I have fixed it in the relevant project with an extension on UserDefinedForm. |
Came across this issue as well. The workaround provided above looked to work! |
Note: You will need to unpublish and republish the form page for the workaroud to work |
The Problem with the workaround is that in order to work all translations need to be unpublished. But unpublishing translations loses all the field translations! |
When I have two page breaks with fields and I delete one I can no longer publish the userformpage. The error I get is "Uncaught Error: Call to a member function publishSingle() on null". What is the problem in this case.
We use SilverStripe 4.6 and Userform 5.6.
We normally not use page breaks, but we automatically add the spamprotectionfield when none has been add. Because our user always forget to add this field. And for some reason it's added in a new page break, after i deleted the page break i had the error.
Other small question would it be not nice to have this function in the modul, that the spamprotectionfield is add automatically? As yml config option?
The text was updated successfully, but these errors were encountered: