This topic is probably as old as the RTC client. If you want to display a text field on a Page you will try for around two hours and then you will give up and maybe build a control addin to solve this.
In the web client this problem was not solved by now. We have fields with length up to 2048 but we are not able to display this.
If you go the normal way you use this:

But the result is frustrating:

Correctly! We get three lines of text. And I tried everything with groups and grids. It did not change.
But this post is not about how bad everything is, I want to present you a solution how this can be done better without any custom control addin.

I may introduce you to the “Microsoft.Dynamics.Nav.Client.WebPageViewer”. This is an awesome small controladdin shipped by microsoft. You can not only embed webpages in Buisness Central but you can also pass your own html!
This is what you need to do:
usercontrol(UserControlDesc; "Microsoft.Dynamics.Nav.Client.WebPageViewer")
{
trigger ControlAddInReady(callbackUrl: Text)
begin
IsReady := true;
FillAddIn();
end;
trigger Callback(data: Text)
begin
Description := data;
end;
}
var
IsReady: Boolean;
trigger OnAfterGetCurrRecord()
begin
if IsReady then
FillAddIn();
end;
local procedure FillAddIn()
begin
CurrPage.UserControlDesc.SetContent(StrSubstNo('<textarea Id="TextArea" maxlength="%2" style="width:100%;height:100%;resize: none; font-family:"Segoe UI", "Segoe WP", Segoe, device-segoe, Tahoma, Helvetica, Arial, sans-serif !important; font-size: 10.5pt !important;" OnChange="window.parent.WebPageViewerHelper.TriggerCallback(document.getElementById(''TextArea'').value)">%1</textarea>', Description, MaxStrLen(Description)));
end;
What did I do there?
The HTML Control I used is a simple <textarea>. With maxlength you want to limit the field to the length of you text field on you table. In my case this is 2048. With the style tag, I set width and height to the max size of the space there is for this control addin.
Now the magic: With the OnChange setting of the textarea I defined what happens if the content is changed. This does not happen on every letter you type but if the textarea looses focus. The TriggerCallback function then passes the content of this textarea to our “trigger Callback(data: Text)” function. There we can simply write the content back to the table field.
Feel free to try this and give me some feedback, maybe there is still something to improve!
Ahaa, its pleasant dialogue regarding this piece of writing
at this place at this weblog, I have read all that,
so at this time me also commenting at this place. I’ve been browsing online more than 3 hours lately, yet I never discovered any fascinating article like yours.
It’s beautiful price sufficient for me. In my view,
if all website owners and bloggers made good content material
as you probably did, the net shall be a lot more helpful
than ever before. There is definately a lot to learn about this issue.
I like all the points you made. http://foxnews.co.uk
My homepage: Jason
LikeLiked by 1 person
I’m extremely inspired with your writing skills and
also with the layout to your blog. Is this a paid theme or did you modify it your self?
Anyway keep up the excellent high quality writing, it is rare to peer a great weblog like this one these days.. https://npseniorliving.com/communities/north-shore/
LikeLiked by 1 person
No, its a free theme 😉
LikeLiked by 1 person
Good Web-site, Preserve the very good work. Thank you. http://21megaportal.com
LikeLiked by 1 person
Good Web-site, Preserve the very good work.
Thank you.
LikeLiked by 1 person
Way cool! Some very valid points! I appreciate you penning this article and the rest of the site is also very good.
Howdy! This blog post couldn’t be written any better! Going through
this article reminds me of my previous roommate! He constantly kept preaching about this.
I’ll forward this article to him. Pretty sure he’s going to have a great
read. Thanks for sharing! Heya i am for the primary time here.
I found this board and I in finding It truly useful & it helped me out much.
I am hoping to present one thing again and aid others such as you aided me.
http://Linux.com/
Here is my blog … Jack
LikeLiked by 1 person
Usually I do not learn article on blogs, but I would like to say that this write-up
very compelled me to check out and do it! Your writing taste has been surprised me.
Thank you, very nice post.
LikeLiked by 1 person
Definitely consider that which you stated. Your favorite justification seemed to be on the net the simplest factor to keep in mind of. I say to you, I definitely get irked even as other people consider concerns that they plainly do not realize about. You controlled to hit the nail upon the highest and also defined out the whole thing without having side-effects , other folks can take a signal. Will probably be again to get more. Thank you
LikeLiked by 1 person
Thanks a lot for the blog post. Great.
LikeLiked by 1 person
Hi,
Can you please leave objects for download?
LikeLike
The addin should be available without installing anything as it is part of the base app shipped by microsoft. The rest of the code needed is available is this blog.
LikeLike
Thanks for the great post!
I am trying to implement it in Business Central 14.0 OnPrem in C/AL. It works in RTC, but in WebClient I always got a method ControlAddIn not Found error message. I also tried to modify the manifest.xml to leave out the CDATA line for ControlAddInReady and leave the Startup JavaScipt call only, but the same happens.
Any ideas, how to solve the issue? Thanks for your support!
LikeLike
Very nice post.
I copied your code but it didn’t worked. On the page it doesn’t show up anything until i realized i had to add the AplicationArea Parameter in the usercontrol.
LikeLike
How would you make this work with a blob type field?
LikeLike
Thank you!!!
Same ,twisted on many side – nothing with multilines standard stuff.
LikeLike
Great post. Besides the onChange trigger on the TextArea you could (also) implement the onInput trigger to ensure your Description field will be updated
LikeLike
Thanks a lot for this solution. It works like a charm !
LikeLike
Is there a way to make UserControlDesc not editable? or prevent user from changing value in it?
LikeLike
Hi, where should I define usercontrol(UserControlDesc;… ? On Page, table?
LikeLike