Developer forum

Forum » Templates » DW 9.3.1 - RenderParagraphContent in forms for editors template

DW 9.3.1 - RenderParagraphContent in forms for editors template

René Poulsen
René Poulsen
Reply

Hi,

I'm having trouble using RenderParagraphContent([ParagraphID]) in a forms for editors template. When using it, it just results in this output in the HTML <!--@Global:Paragraph.Content([ParagraphID])-->.

I've made sure that the ID i use exists by putting the same code in the master template. When doint that, the content appears as it's suppposed to. It this a bug in DW or isn't it possible to do that?


Replies

 
Nicolai Pedersen
Reply

You cannot in html templates. You have to use a Razor template to render a paragraph in module templates using @RenderParagraphContent(123)

And are you sure you want a paragraph rendered in your form....?

 
René Poulsen
René Poulsen
Reply

I am using a Razor template and @RenderParagraphContent(). It just results in <!--@Global:Paragraph.Content--> in the HTML outputtet by DW.

Yeah, I'm pretty sure I want a a paragraph renderede in between some of my fields. I need some short explanations (with links) for some of the fields.

 
Nicolai Pedersen
Reply

And the paragraph is active?

 
René Poulsen
René Poulsen
Reply

Yes. As I mentioned in the first post it works fine when I use the code in the master template. But when placed in the forms template, nothing happens.

You can see how it's rendered in the screenshot attached. As you can see I've tried two different approaches. In the first one the ID comes from the description field on the form field. In the second one I've just hardcoded the ID of the paragraph. None of them works:

@RenderParagraphContent(@field.GetInteger("Field.Text"))
@RenderParagraphContent(29)
Skærmbillede_2017-11-09_kl._11.04.04.png
 
René Poulsen
René Poulsen
Reply

Bump

 
René Poulsen
René Poulsen
Reply

Bump bump :-)

 
René Poulsen
René Poulsen
Reply

Bump bump bump :-) Shouldn't this be possible?

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi René

I’ve tested the feature at my solution based on 931 as you wrote. Razor template for the form module and HTML/Razor for paragraph pointed via tag were used. I have good results, please have a look at the video – https://www.screencast.com/t/7acHsj4mb to comment if your way is different against mine.

BR, Oleg QA 

 
René Poulsen
René Poulsen
Reply

Hi Oleg,

Great that it works on your solution. That doesn't help me much though ;-)

I typed exactly @RenderPagrapgrahContent(29) in my template and it just results in the html output attached in one of my previous messages. As I also wrote, it works fint when placing it in the master template. Any ideas?

 
Nicolai Pedersen
Reply

Hi René

First make sure you are fully updated.

Otherwise we would require full access to your solution to debug it further. You are welcome to post it here or create a case to get the service desk to look at your setup.

BR Nicolai

 
Jacob Storgaard Jensen
Reply

Hi René,
A dirty hack could be to wrap it in a Snippet on your master template and then render that one inside your form...

@SnippetStart("FormParagraph")
@RenderParagraphContent(29)
@SnippetEnd("FormParagraph")

<input something />
@RenderSnippet("FormParagraph")
<input something />
 
René Poulsen
René Poulsen
Reply

Hi Jacob.

I'm already trying to make a dirty hack ;-) I want to show some richtext content between fields in a form. I'm using one of the fields to enter a paragraph id - and then use that in a RenderParagraphContent. So putting it in a snippet outside of the form template wouldn't work in this case for my dirty hack ;-)

 
Jacob Storgaard Jensen
Reply

Ah, that might be the reason, which wasn't totally clear in your initial post... that the ID came from a form field... due to the order in which things are rendered...

 
René Poulsen
René Poulsen
Reply

I tried with a hardcoded ID as well - that didn't work either. So the question is just if it was supposed to work in the form template or not.

But yeah - my intention was to use the hack as described :-)

 
Jacob Storgaard Jensen
Reply

Okay, but if a hardcoded solution is ok... then the snippet thing should work... Because the "snippet move" should be the last thing done in the render process... so it the paragraph content renders on the master template, you could move it with a snippet...

 

You must be logged in to post in the forum