Error: "The entity "nbsp" was referenced, but not declared."

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
RLJB
Posts: 914
Joined: Tue Jan 05, 2010 10:16 am
Location: Sydney, Australia

Error: "The entity "nbsp" was referenced, but not declared."

Post by RLJB »

We used to get this occasionally from users when they copy text from another system (email client) and go to paste it in our Aware built app. Now seems to be an increasing occurrence, does anyone get this complaint from users a lot?have any tips about how to avoid it?
Rod. Aware 8.6 (latest build), Developer Edition, on OS Linux (Ubuntu) using GUI hosted on AWS EC2, MYSQL on AWS RDS
kklosson
Posts: 1617
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Re: Error: "The entity "nbsp" was referenced, but not declar

Post by kklosson »

I do see it regularly but do not have a resolution. Possibly a text encoding thing. I use MySQL 5.6. Note that in my case, the error is caused by pasting text from either MS Word or PDF documents. I'm sure you recognize nbsp as an HTML tag.
V8.8
MySQL, AWS EC2, S3
PDFtk Toolkit
softserv
Posts: 93
Joined: Mon Aug 01, 2016 12:52 am
Location: Jaipur, India
Contact:

Re: Error: "The entity "nbsp" was referenced, but not declar

Post by softserv »

We also face this issue many times and have followed a poka-yoke approach. One quick solution is to remove "NBSP" in the component (AIM Attribute) before creating the BO. We can implement below shown code snippet at On-Change event of txtArea. This will remove any NBSPs after typing or copy-pasting.
------------------------------------------------------------------
$('#'+txtAreaId).change(function(){
$('#'+txtAreaId).val($('#'+txtAreaId).val().replace(/ /g, ''));
});

------------------------------------------------------------------
In AIM, this can be written under Render Script section of Main Form >> Advanced >> Scripts.
Team SoftServ

V8.3 2628 |V8.2 2574 |V8.1 2475 | V8.0 2372 | V7.1 2240 | V6.0 2042 | V5.9 1894
MS SQL Server | MySQL
AWS | Azure | Google Cloud

Image
SoftServ - AwareIM
joben
Posts: 221
Joined: Wed Nov 06, 2019 9:49 pm
Location: Sweden
Contact:

Re: Error: "The entity "nbsp" was referenced, but not declar

Post by joben »

softserv wrote:We also face this issue many times and have followed a poka-yoke approach. One quick solution is to remove "NBSP" in the component (AIM Attribute) before creating the BO. We can implement below shown code snippet at On-Change event of txtArea. This will remove any NBSPs after typing or copy-pasting.
------------------------------------------------------------------
$('#'+txtAreaId).change(function(){
$('#'+txtAreaId).val($('#'+txtAreaId).val().replace(/ /g, ''));
});

------------------------------------------------------------------
In AIM, this can be written under Render Script section of Main Form >> Advanced >> Scripts.
Thanks! Your code worked nicely for us with a few modifications:

Code: Select all

$('#Gatuadress').change(function(){
$('#Gatuadress').val($('#Gatuadress').val().replace(' ', ''));
});
The ID reference didn't work so we modified that. Also, the / /g encapsulation of the space character entity didn't work either. We used ALT+255 to write the nbsp space character.
Regards, Joakim

Image
Post Reply