Something went wrong while trying to load the full version of this site. Try hard-refreshing this page to fix the error.

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

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?


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.


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.

------------------------------------------------------------------
[b]$('#'+txtAreaId).change(function(){
			$('#'+txtAreaId).val($('#'+txtAreaId).val().replace(/ /g, ''));
		});[/b]
------------------------------------------------------------------

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


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.

------------------------------------------------------------------
[b]$('#'+txtAreaId).change(function(){
 $('#'+txtAreaId).val($('#'+txtAreaId).val().replace(/ /g, ''));
 });[/b]
------------------------------------------------------------------

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:

$('#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.