Trying to write a rule that sets the template for all children of a specific parent. But the rule has no effect.
Here is my rule:
Action : Create Resource (Have also tried Create and Edit Resource)
Template: (empty)
Constraint Field: parent
Constraint: 6
And then on the “template” field I set a default value of 3 which is the template ID I want the child pages of parent 6 to have set upon creation.
The rule set is checked active and its profile is checked active. There is no user group assigned so it should work for all users.
Both Create and Quick Create produce a new child resource with the base template, NOT the expected template with ID of 3.
I have cleared the cache a dozen times, hard refreshed the browser, logged in and out of the manager several times as different users, and tried different browsers. There are no errors in the manager log that seem connected, and no JS errors in the console.
This is a MODX Cloud site, recently updated from 3.0.3 (I think) and now at 3.0.5-pl. I know there were some issues with form customization a few versions ago, but thought it was patched… Maybe I should try reinstalling 3.0.5?
Is it perhaps the case that the rule is only applied when you first hit Save on your new Resource?
I normally use the ForceTemplate extra to do what you’re trying to achieve.
It’s a really simple tool but you might want to disable the Template Picker [enable_template_picker_in_tree ] system setting as I don’t think ForceTemplate works with this.
The form customization should still work correctly in MODX 3, if the system setting enable_template_picker_in_tree is set to No.
It seems that the template picker (that was introduced with MODX 3) only takes the default_template setting into account, and ignores other settings like automatic_template_assignment or form customizations (like in your case).
Absolutely - I think I’m right in saying though, that in Lucy’s case, Form Customzation is working as expected - it just doesn’t do what is required in this case.
Yep - I don’t really use the Template Picker personally - and since it behaves differently in terms of applying templates - it reduces the chance of confusion if I just disable it - especially if using ForceTemplate.
Thanks to you both for your replies – I have disabled the enable_template_picker_in_tree setting – but it only HALF fixes this. Now using the Create menu option sets the correct template (ID 3 as set in the rule), but using the Quick Create option still sets the default template.
I also want to point out what seems to me to be a bug, that the system setting automatic_template_assignment which is currently set at its default of sibling is not working as expected. Since there are already children of this parent and they are all using the template ID 3, it should not have been necessary for me to create a rule since any new resources here should have inherited their siblings’ template, right?
Anyway - I think my solution for now will be to disable the Quick Create menu option, which I hope is possible to do…
This seems to work as expected for me using Create / Document [correct sibling template is selected] but not using Quick Create / Document [default template is selected].