NetTalk Central

Author Topic: Display HTML on a form  (Read 3093 times)

JohanR

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • Email
Display HTML on a form
« on: June 14, 2013, 02:41:08 AM »


Hi,

I have a comment field that I would like to use to display some info to the user.
I have tried a variety of things but not getting the desired results.

How to display a piece of HTML on a form?

Do I use a text or display field?
Does it need complete HTML headers?


thanks

Johan

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Display HTML on a form
« Reply #1 on: June 14, 2013, 03:30:22 AM »

>> How to display a piece of HTML on a form?

use a form-field, "Display" type, with "Allow xHTML" turned on.

>> Does it need complete HTML headers?

no, it's not an HTML page, it's an HTML field. So just a simple HTML snippet will be fine.

cheers
Bruce


JohanR

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • Email
Re: Display HTML on a form
« Reply #2 on: June 14, 2013, 03:59:20 AM »

Hi Bruce

Exactly what I started with, but after that failed it went downhill from there.

All I am getting is the HTML being displayed in the field.

This is my field being loaded

           loc:scr_memo = '<html><p>' & |
                          'Transaction failed' & '<br>' & |
                          'Response :' & clip(cct:result) & '<br>' & |
                          'Date :' & format(today(),@d05) & '<br>' & |
                          'Time :' & format(clock(),@t06) & '<br>' & |
                          'Result Code :' & clip(cct:code) & '<br>' & |
                          '--------------------------' & '<br>' & '</p></html>'

and this is from the browser firebug window

<div class=" vc_hdr_1" id="loc:scr_memo">&lt;html&gt;&lt;p&gt;Transaction failed&lt;br&gt;Response :&lt;br&gt;Date :14/06/13&lt;br&gt;Time :01:53:36PM&lt;br&gt;Result Code :&lt;br&gt;--------------------------&lt;br&gt;&lt;/p&gt;&lt;/html&gt;</div>


Perhaps I am not formatting the string correctly?
The xHtml tick is def on.



thanks

Johan



Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Display HTML on a form
« Reply #3 on: June 14, 2013, 04:04:10 AM »
xHTML <> HTML.
Your code is HTML, and it needs to be xHTML.

a simple

loc:scr_memo  = p_web.HtmlToXhtml( loc:scr_memo)

may be enough - although it's certainly not a universal fix. (it just fixes some common mistakes like you using <br> instead of <br/>.

If you still have no joy, edit one of the examples and post it.

cheers
Bruce

JohanR

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • Email
Re: Display HTML on a form
« Reply #4 on: June 16, 2013, 12:39:06 AM »


Hi Bruce

Thanks!
Sorry , forgot the crucial part about html and xhtml.

Changed my code, still did not work and eventually found the problem.

I started with the block of code with <html> and closed with </html>

The html tag not needed at all


Johan