You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using ajax or direct form post with an action "elements/save-draft" from front end, action return a template error "Unable to find the template “_includes/forms/text”". I am using this action to save a draft for existing entry to provide a preview to end user.
The error is occur on
src/controllers/ElementsController @ Line 1151
$form = $fieldLayout->createForm(...)
This action is loading templates from front end template folder, instead of vendors folder, to bulild response. Actions works as excepted from control panel.
After reading the sourece code, I am not sure it is intended to process this way or not, because it makes sense to build form tabs on control panel. However, as Craft 4 has change "entry-revisions/save-draft" to "elements/save-draft", and seem like there is no other alternative actions to save draft from front end nativly from Craft.
Therefore, my question is:
Should action "elements/save-draft" be only used on developing custom control panel plugins? We should write custom action to handle element draft for front end.
Steps to reproduce
Form submit from front end with action "elements/save-draft" with proper elementId, Element types and other required data, even using exact same payload for Preview.
Expected behavior
Can return an response as action from control panal to save a draft.
Actual behavior
Draft is not created in database, because the form render error interrupt the response building process.
What happened?
Description
When using ajax or direct form post with an action "elements/save-draft" from front end, action return a template error "Unable to find the template “_includes/forms/text”". I am using this action to save a draft for existing entry to provide a preview to end user.
The error is occur on
src/controllers/ElementsController @ Line 1151
This action is loading templates from front end template folder, instead of vendors folder, to bulild response. Actions works as excepted from control panel.
After reading the sourece code, I am not sure it is intended to process this way or not, because it makes sense to build form tabs on control panel. However, as Craft 4 has change "entry-revisions/save-draft" to "elements/save-draft", and seem like there is no other alternative actions to save draft from front end nativly from Craft.
Therefore, my question is:
Should action "elements/save-draft" be only used on developing custom control panel plugins? We should write custom action to handle element draft for front end.
Steps to reproduce
Expected behavior
Can return an response as action from control panal to save a draft.
Actual behavior
Draft is not created in database, because the form render error interrupt the response building process.
Stack:
Craft CMS version
4.2.4
PHP version
8.1.9
Operating system and version
Windows 10 21H2
Database type and version
MariaDB 10.4.10
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: