none
html tags in edit box. RRS feed

  • Question

  • I have a memo field which contains email body content. I'm using an edit box to display the body content on a form. Is there a way to tell vfp to treat this as an html, or do I need to use a browser control? what's the best way of doing this?

    Thanks.

    Sunday, March 24, 2019 3:15 PM

Answers

  • You've answered this yourself. There is no HTML control and the only thing a VFP editor and the editbox might do is turn a link into a blue underlined link via _vfp.EditorOptions, but it's not rendering HTML. a WebBrowser control is.

    So have a webbrowser control aside the grid and show the active records html by loading it into the control via embedding into a HTML skeleton and storing into a file - just one idea. If you don't want to navigate to a file URL, you may initially show "about:blank" , that's a sepcific URL letting a web browser show an empty document, but that's what you get, you have a document element instead of nothing and you can set that documents body to your HTML to display it.

    Bye, Olaf.

    • Marked as answer by Aleniko2 Sunday, March 24, 2019 4:04 PM
    Sunday, March 24, 2019 3:25 PM

All replies

  • You've answered this yourself. There is no HTML control and the only thing a VFP editor and the editbox might do is turn a link into a blue underlined link via _vfp.EditorOptions, but it's not rendering HTML. a WebBrowser control is.

    So have a webbrowser control aside the grid and show the active records html by loading it into the control via embedding into a HTML skeleton and storing into a file - just one idea. If you don't want to navigate to a file URL, you may initially show "about:blank" , that's a sepcific URL letting a web browser show an empty document, but that's what you get, you have a document element instead of nothing and you can set that documents body to your HTML to display it.

    Bye, Olaf.

    • Marked as answer by Aleniko2 Sunday, March 24, 2019 4:04 PM
    Sunday, March 24, 2019 3:25 PM
  • Hi Aleniko2

    I wrote my own HTML editor by using the ole Browser control. You can activate the edit mode and then write whatever HTML code you want. However, this is a really tricky way to choose.

    I got the basic idea from a blog post by Yousfi Benameur. So, have a look to see how it's done.

    http://yousfi.over-blog.com/2015/02/a-vfp-html-richtext-editor.html

    HTH


    Gruss / Best regards
    -Tom
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible,
    you are, by definition, not smart enough to debug it. 010101100100011001010000011110000101001001101111011000110110101101110011

    Sunday, March 24, 2019 7:59 PM
    Moderator
  • I tried to use this as an editor for a website, but not just for IE, for any browser. You can use the contenteditable attribute. It's a mess what HTML gets generated when you do several things and I came to the conclusion markdown is a better idea, which is what forums are doing for over a decade.

    There once was a nice project https://www.alohaeditor.org/, but that is somewhat stale.

    They tried to address the issue with native contenteditable and managed quite well.

    Rick Strahl wrote about the edit mode here and originally there was another post I don't find anymore.

    Anyway, I don't know if this is about HTML editing, if you know your HTML you might just want the HTML rendering and nothing more. The simplest way to stay with human readably and maintainable HTML still is to write HTML yourself, in my opinion and then to make it simpler for non techy users define a markdown definition.

    Just my 2 cents. My goal was and is to get this done for a website in any browser without any client, neither Foxpro nor .NET or Java, in the era of WiX and Jimdo and Squarespace you should be able to offer content editing of a website on site itself with no other tool than a browser.

    The topic here is obviously writing HTML for HTML mails and as that's part of a Foxpro app it makes some sense, but you also define another thing binding your code to be less portable if you do that with a IE or webbrowser control feature.

    Bye, Olaf.

    Sunday, March 24, 2019 8:57 PM
  • Indeed, I also did it for an email frontend that had to provide RTF and HTML. Therefore it was more than enough.

    However, for creating webpages or complete sites it would indeed be the worst access of all :)

    When coding for the web, I like to use Visual Studio Code and Atom as both fully integrate jQuery, jqWidgets, Bootstrap a.s.o. and sometimes I even use the old ExpressionWeb4. :)


    Gruss / Best regards
    -Tom
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible,
    you are, by definition, not smart enough to debug it. 010101100100011001010000011110000101001001101111011000110110101101110011

    Monday, March 25, 2019 12:32 PM
    Moderator
  • I've been using an ActiveX component for HTML editing and that has worked pretty well.  You can find it here: https://nbit.net.au/viewpage.aspx?ID=HTMLOCX&Parent=HTMLOCX

    Kevin Clark

    Tuesday, March 26, 2019 2:38 PM