Content Template within Custom From

(Michael Wilson) #1

Matrix Version:

I want to use a Content Template (CT) within a Custom Form to automatically add things like a custom error summary at the top, custom submit buttons at the bottom, etc. My custom form keyword replacements are not working inside the CT’s paint layout. e.g. in the paint layout:

<div class="alert alert-danger has-errors" role="alert">%form_errors%</div>
<div class="custom-button">%submit_button%</div>

The form keywords don’t produce anything. Is this because the paint layout is applied before the form fields actually exist? Thanks.

(Iain Simmons) #2

%paint_layout% is used in the Page Contents bodycopy of the Paint Layout asset. Anything else specific to the asset should probably go in the Default Format (or type format).

Container Templates are applied to a container, not to the top level asset like a page or in your case, custom form. So keywords for the page won’t work.

You could try %frontend_asset_attribute_form_errors% or %frontend_asset_assetid^as_asset:form_errors% in the Paint Layout default format and see how that goes.