StatCan / StatCan.OrchardCore

Houses StatCan OrchardCore Modules
https://statcan.github.io/StatCan.OrchardCore/
MIT License
55 stars 12 forks source link

VueForms Template Model Data #344

Closed emrahtokalak closed 1 year ago

emrahtokalak commented 1 year ago

Hi @jptissot

I can't access {{ Model }} data in Vueform template field, returns null. {{ Model | console_log }} is same. I can access the User data, I wrote this just to test it.

I am using Shape as follows;

{% assign VueFormsWidget = Model.ContentItem.Content.FlowPart.Widgets.first %} {% assign VueFormsId = VueFormsWidget.VueFormReference.FormReference.ContentItemIds.first | content_item_id %} {% assign VueFormsShape = VueFormsId | shape_build_display %} {% shape_add_properties VueFormsShape category_items: Model.ContentItem.Content.Categories.ContentItems, currentpage: Model.ContentItem %} {{ VueFormsShape | shape_render }}

Screenshot 2023-01-21 at 19 54 51

Where could I be doing wrong?

jptissot commented 1 year ago

@emrahtokalak Hey, I just logged back in to Github after some time off. Let me know if you are still having this issue.

emrahtokalak commented 1 year ago

Hi @jptissot,

Still can't access data {{ Model }} in Vueform template field returns null.

https://github.com/OrchardCMS/OrchardCore/discussions/7030 I tried using the IShapeTableProvider suggested here, but with no results.

emrahtokalak commented 1 year ago

I solved the problem.

By sending Model data instead of ContentItem, I was able to get the data I wanted.

https://github.com/StatCan/StatCan.OrchardCore/blob/master/src/Modules/StatCan.OrchardCore.VueForms/Views/VueForm-CommonTemplate.cshtml#L15