NetTalk Central

Author Topic: Ampersand in data causing an issue  (Read 4826 times)

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Ampersand in data causing an issue
« on: October 11, 2012, 11:09:37 AM »
I know I'm behind the times using ver 6.26  (the session Id change scared me off.)

We're having a problem in 2 sites - when the data has an ampersand (&) the page won't display properly or at all.

Any suggestions? Will an update help?

Thanks,
Chris
Real programmers use copy con newapp.exe

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Ampersand in data causing an issue
« Reply #1 on: October 11, 2012, 01:00:45 PM »
Hi Chris,
What type of data field are you having this problem? If it is a field where you have checked to allow XHMTL, this could be the cause the problem.
In my app, I have entered and seen ampersand in String, Display and Text fields without any problems. 
I am using NT V6.46 though.
Rob Kolanko

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Ampersand in data causing an issue
« Reply #2 on: October 11, 2012, 01:14:33 PM »
Hi Chris,

A normal ampersand will break AJAX (when your app asks NT for a piece of data to update a page - which goes on all the time).

Often data will appear correctly when the page first loads (no AJAX). Then breaks when you try and do stuff.

In most cases NT looks after this for you, by "escaping" or "encoding" the ampersand "&" instead of "&".

You might be putting some fields on a browse or form where this isnt happening. If you are doing this yourself you'll need to "escape" your data first.

p_web._escape(My:Field)    or is it p_web._encode(MyField)    or p_web.jsok()  ... its one of those from memory.

I think Firefox (with Firebug) is the best browser for diagnosing these problems as it can detect non-XHTML data for you.

Regards
Bill Shields
« Last Edit: October 11, 2012, 01:34:49 PM by bshields »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Ampersand in data causing an issue
« Reply #3 on: October 11, 2012, 10:07:03 PM »
Chris,

>> the session Id change scared me off.

Fear is the path to the dark side.
Fear leads to anger.
Anger leads to hate.
Hate leads to suffering.
(yoda)

On a more serious note, what part of it scares you?

cheers
Bruce



ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: Ampersand in data causing an issue
« Reply #4 on: October 12, 2012, 05:54:32 AM »
Thanks for the nudge, Rob & Bill. First step will be to update NT

Bruce - Without getting into too much detail, I have a bunch of code in a large app that uses the sessionid and didn't have time to find what would break by changing that to a string.
I guess I'm about to find out, though, because I downloaded the latest release.

The good news is that, for this app, it fixes the problem. Ampersands are displayed correctly.

Thanks,
Chris




Real programmers use copy con newapp.exe

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Ampersand in data causing an issue
« Reply #5 on: October 14, 2012, 02:32:22 PM »
Chris there is an option on the webserver template to keep the sessionid as a long.

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: Ampersand in data causing an issue
« Reply #6 on: October 15, 2012, 06:21:41 AM »
Thanks, Kevin - I didn't know that. I'll look for it.
Real programmers use copy con newapp.exe