Custom form asset listings


(Mark Graham) #1

Matrix Version: 5.3.4.2

Hi guys,

I’m experimenting with using nested asset listing to automate custom form designs for our editors (They’re not very comfortable with the typical keyword replacement/markup).

I got it working pretty well using 2 listings, one for sections, and one nested for the questions in that section. However I’ve run into an issue where I’m not getting the error text for validation errors. I have a feeling it might be due to the keyword replacement I’m using to print the forms, but would just like a second opinion.

These are the replacements I’m using:
%asset_assetid^replace_keywords:as_asset:question_note_{asset_assetid^replace:::}%
%asset_assetid^replace_keywords:as_asset:question_error
{asset_assetid^replace:::}%
%asset_assetid^replace_keywords:as_asset:question_label
{asset_assetid^replace:::}%
%asset_assetid^replace_keywords:as_asset:question_field
{asset_assetid^replace:::_}%

I can’t use the classic %question_{section_id}_{question_num}% syntax, because I don’t know that information in the listing. Hence the funky keyword modifiers.

Any advice is appreciated!

Thanks,
Mark


(Bart Banda) #2

Interesting way of doing it, I’m not sure that’s even really supported so I’m not surprised that the error keywords don’t work as they get evaluated on POST time.

There is an idea in our roadmap to be able to template form layouts, we haven’t got quite a spec for it yet but it’s definitely something we are aiming to add.

What’s the specific format you want on the front end?

Shame you are not in 5.4, as you could then use the SSJS to format your Custom Form in anyway you wanted.


(Mark Graham) #3

Thanks for the response Bart.

I ended up working out what the problem was. I was using a %submit_button% in the asset listing, instead of the form. So its attributes were for submitting an asset listing instead of a form. Some JS to change the submit ID etc. fixed up the issues I was having.

Having template formats for forms would be awesome. I’ve also experimented using content container templates, but they have to be applied in _admin for form body copies.

We’ve not had any specific CSS for our forms for a long time. So we’re trying to modernize them over time using some new styles and layouts.


(Harinder Singh) #4

I am doing something similar. Trying to generate Custom form elements with Asset Listing but now stuck with Radio type and Checkbox input fields questions.

I tried above keywords but for some unknown reason they are not printing anything for me.

Any Suggestion???