This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi every body,
The plugin get an Html file, uploaded from beckend view, extract some html tags and write it in a specific content/folder. Then it save a record in the plugin, in order to keep trace of the upload. Everiting is working fine. But I want to stop the saving item behaviour if the content/folder already exist.
For the folder writing and control loop I used the formBeforeSave() function inside the Controller:: Class. Inside the function I can stop the saving task, but a Flash success message is shown anyway. I understood that is a sort of redirect problem... but how to redirect or refresh sending a error message to the page?
I tried several Redirect:: class function but nothing changed.
Thank you all in advance.
Carmelo
How are you stopping the saving task? I was thinking you could stop the processing of the form all together by throwing an \ApplicationException('Not processing any further because folder exists');
Hi philipptempel,
thank you for you suggestion, you was right!!
I fixed using
throw new ValidationException(['my_field'=>'message'])
For who will face the same issue, or similar
Documentation here: https://octobercms.com/docs/services/error-log
Thanks
Last updated
1-3 of 3