NetTalk Central

Author Topic: Embedding HTML  (Read 3340 times)

Perkins

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Embedding HTML
« on: February 01, 2013, 12:20:02 PM »
I have some code that generates the following html...


<p>Your network has a permanent connection to the Internet. Your local network<br/>includes multiple services. You are concerned about hackers gaining access from the Internet. You decide to set up filtering on ports 100 through 200. Which service might this affect?</p><input type="radio" name="answer" value="Answer1">FTP<br/> <input type="radio" name="answer" value="Answer2">NTP<br/> <input type="radio" name="answer" value="Answer3">HTTP<br/> <input type="radio" name="answer" value="Answer4">SMTP<br/>

I have tried loading this into and text field on a webform but it doesn't show it as html.  It just shows it as text.  the code that generates this is executed in the LoadRelatedRecords embed after Start.  I do have allow XHTML checked on.  I can copy this text to a redactor control after clicking the </> button and clicking it again makes the html show up correctly.  Funny thing though, clicking that button multiple times will remove the check boxes. 

I'm just trying to find a good way to do this so that I can show a little progress on this thing. 

TIA


Dennis Perkins

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Embedding HTML
« Reply #1 on: February 01, 2013, 09:51:03 PM »
run the Debugview program and see if any messages appear there. If the HTML is considered "unsafe" then it'll tell you, and why. You can then "allow unsafe" if you like, but you need to understand the impact of that.

Also, I notice the <input> tags have no closing tag, so this is not valid xHtml - which may cause problems in some cases as well.

cheers
Bruce

Perkins

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Embedding HTML
« Reply #2 on: February 02, 2013, 11:49:49 AM »
Here is a list from the debug view....

[3936] [netTrace][thread=4] Error [-1:2] opening file: C:\CiTest\web\favicon.ico
[3936] [netTrace][thread=4] Sendfile error 404, Error 404 filename=C:\CiTest\web\favicon.ico
[3936] [netTrace][thread=4] SendError = 404 The page cannot be found : The page you are looking for might have been removed, had its name changed, or is temporarily unavailable. FileRequest=[favicon.ico]
[3936] [netTrace][thread=4] Error [-1:2] opening file: C:\CiTest\web\browsetest_browsequestion_value
[3936] [netTrace][thread=4] Sendfile error 404, Error 404 filename=C:\CiTest\web\browsetest_browsequestion_value
[3936] [netTrace][thread=4] SendError = 404 The page cannot be found : The page you are looking for might have been removed, had its name changed, or is temporarily unavailable. FileRequest=[browsetest_browsequestion_value]
[3936] [netTrace][thread=3] UnSafeHtml (4): Tag not allowed: input


First I'm at a total loss on what and where the favicon.ico is being called from.  I also don't know what thre reference to browsetest_browsequestion_value is.  I do have browsetest and browsequestion procedures, and the browsequestion is called as a child to browsetest.

I'm also getting the following error in debugview when the index page initially loads.   I'm having a hard time find this reference in the templates.

[3936] [netTrace][thread=3] Error [-1:2] opening file: C:\CiTest\web\styles\Custom.Css
[3936] [netTrace][thread=3] Sendfile error 404, Error 404 filename=C:\CiTest\web\styles\Custom.Css


From what I can see most the errors above are not related to my initial problem but the error below is. 
[3936] [netTrace][thread=3] UnSafeHtml (4): Tag not allowed: input

With some testing I discovered that I could get the html to show up correctly if I turned unsafe xhtml on and selected the Redactor as the editor.  If I removed either would would go back to the text.

I think part of my  problem here is that I'm using a text field and I don't really need to do that.  I need to be able to generate this html on the fly on a question by question basis and record the results. 

I tried using the XHTML tab on the NetWebForm procedure but anything I tried with inputs would break the form.  I typed the following into the XHTML text box provided by the template.

I tried closing the input tag this way.
<p>Which three services does a proxy server provide? (Choose three.)</p>
<input type="checkbox" name="answer" value="Answer1">&nbsp;cached e-mail</input>

I tried closing the input tag this way.
<p>Which three services does a proxy server provide? (Choose three.)</p>
<input type="checkbox" name="answer" value="Answer1"/>&nbsp;cached e-mail

If I remove the input it works just fine. I even figured out how to get the html on the tab, but I could not get the input formatted in a way to make it work. I'm open to a different approach on this I just need a way to make this work. 


Dennis Perkins

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Embedding HTML
« Reply #3 on: February 04, 2013, 06:37:52 AM »
Hi Dennis,

>> First I'm at a total loss on what and where the favicon.ico is being called from.

Favicon.ico is requested by the browser when it gets to a site. It's an icon you put in the web folder, which then is used by the browser on the tab heading etc. You can ignore it if you like.

BTW - which build of NetTalk are you using? Later builds supply the browser with a default favicon if none exists (so it stops asking for a bit.)

>> I'm also getting the following error in debugview when the index page initially loads.   I'm having a hard time find this reference in the templates.
[3936] [netTrace][thread=3] Error [-1:2] opening file: C:\CiTest\web\styles\Custom.Css

Custom.Css is added to the WebServer procedure, Styles tab, Files tab by the wizard when you create your app. This is a good file to put your custom styles into (or delete the entry from the files list.)

>> I think part of my  problem here is that I'm using a text field and I don't really need to do that.  I need to be able to generate this html on the fly on a question by question basis and record the results. 

yes. Try using a display field.
But you'll need to turn on Unsafe HTML for that too since "input" is not considered "safe" html by the engine.

Cheers
Bruce





Perkins

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Re: Embedding HTML
« Reply #4 on: February 04, 2013, 02:02:59 PM »
>>BTW - which build of NetTalk are you using?

 7.04  The latest I assume

>>yes. Try using a display field.
>>But you'll need to turn on Unsafe HTML for that too since "input" is not considered "safe" html by the engine.

I tried a display field.  It breaks the window when I use it.   If I put the name of the local variable that I load the script into in the Text field and a value in the picture field,  the form displays nothing but a blank tab.   I don't really understand what the Text field is for since the field is already defined at the top. Is there a demo application that shows how to load html into a display field?   Nothing I do even with allowing unsafe XHTML seems to work. 










Dennis Perkins

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Embedding HTML
« Reply #5 on: February 04, 2013, 09:39:16 PM »
Hi Dennis,

I think it would be helpful to you if you took one of the simple examples (say example 1) and tweaked it to show the sort of thing you are trying to do, and post that here. From there we can move you forward one step at a time. At the moment I'm concerned that we're missing the "big picture" and focusing on possible work-arounds - and at the same time I'm not sure what it is you're really trying to achieve.

After all - displaying the radio is one thing, actually getting the information back from it is something else.

So make a small example, and explain a bit more about the context of what you are doing.

Cheers
Bruce