Atozed Forums
Set summernote text programatically - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: Set summernote text programatically (/thread-3014.html)



Set summernote text programatically - john.burgess - 02-04-2023

When setting the textarea of TIWSummernote (e.g. IWSummernote1.Lines.Add('...'); ) programmatically, the control acts as expected, nicely rendering formatted HTML text.

However, if the control is rendered in a project using bootstrap template, the text area appears to be rendered in a separate frame which does not occupy the full width, and the html is shown as a literal sting.

   

The code I am using in both scenarios is the same:
IWSummernote1.Lines.Add('<p>Hello<br><b>World</b></p>');

Using Intraweb 15.6.9 ultimate.


RE: Set summernote text programatically - john.burgess - 02-06-2023

(02-04-2023, 12:15 AM)john.burgess Wrote: When setting the textarea of TIWSummernote (e.g. IWSummernote1.Lines.Add('...'); ) programmatically, the control acts as expected, nicely rendering formatted HTML text.

However, if the control is rendered in a project using bootstrap template, the text area appears to be rendered in a separate frame which does not occupy the full width, and the html is shown as a literal sting.



The code I am using in both scenarios is the same:
IWSummernote1.Lines.Add('<p>Hello<br><b>World</b></p>');

Using Intraweb 15.6.9 ultimate.

Just to provide more clarity to this problem I have discovered that IWSummernote renders OK if the text is set programmatically during form onShow but not if I attempt to (re)set the text programatically within an async method on the form - e.g. selecting an item from a IWBSSelect. So it seems this is not related to the use of templates but the ajax refresh of the control after the form has already been shown. I will continue testing this and add any further findings to this thread - but would appreciate any suggestions as to how it can be addressed.


RE: Set summernote text programatically - Alexandre Machado - 02-10-2023

Can you please provide a minimal test case showing your issue?


RE: Set summernote text programatically - john.burgess - 02-11-2023

Thanks for looking at this Alexandre.

Attaching test project.

Text sets ok during form show event but not on button's OnAsyncClick

I have attempted without success various techniques such as asyncrefresh, invalidate etc. to get this to work during the async method.


RE: Set summernote text programatically - Alexandre Machado - 02-12-2023

OK. I'll have a look and get back to you ASAP

Cheers


RE: Set summernote text programatically - gerritschurer - 04-03-2025

(02-12-2023, 10:36 PM)Alexandre Machado Wrote: OK. I'll have a look and get back to you ASAP

Cheers

Hi Alexandre,

This is quite an old thread, so maybe it is solved and I missed it. I encounter the same problems as John. When I use an Async buttonclick to fill the content of the IWSummernote, nothing is shown. Just like him, I tried several refresh, repaint, asyncrender lines, but nothing changed. When I use a Sync buttonclick, the content is shown (but my full page is then rendered, so scroll positions and thelike are lost...

Using Intraweb 16.08

Cheers