Hi Bruce,
You are right, I am trying to do a little more with the response:
I've added this following to my Validate All - 2 End embed point on a netweb form:
! Write to 3rd Party Carrier
IF LOC:Invalid <> '' Then Exit.
DO WriteTPNLive
IF p_web.gsv('TPNErrorMessage') <> ''
loc:InvalidTab = 1
loc:Invalid = 'JOB:JobReference'
JOB:JobReference:IsInvalid = TRUE
LOC:TPNErrorMessage = p_web.gsv('TPNErrorMessage')
ST.SetValue(LOC:TPNErrorMessage)
ST.UrlEncode()
STOP(CLIP(ST.GetValue()))
!ST.Replace('%0D%0A','+')
!ST.UrlDecode()
LOC:Alert = CLIP(p_web._UnEscape(ST.GetValue()))
STOP(LOC:Alert)
p_web.SetAlert(p_web._Unescape(ST.GetValue()))
END
For normally formatted reponses (ie. ones without hidden characters) this seems to work fine. I call Do WriteTPNLive, and this either sets some values in my DB, or Sets the TPNErrorMEssage, which I want to display to the end user. If I trap the error message that comes back from the 3rd party server, it looks fine, but when I assign it to LOC:Alert I don't get a popup warning box, like I do with all of my other validation. When I check the source of the page that has been generated, I see the following:
<div id="_busy" class="nt-busy" data-nt-busy="busy"><img src="/images/_busy.gif" /></div><div id="_ver651" class="nt-alert ui-state-error ui-corner-all">Error in site JavaScript</div><script>versionCheck('6.51');getScreenSize()</script>
If I manually set LOC:Alert to be 'Hello World' it works as expected.
So I deduced that there must be some hidden chars in the error message that I couldn't see in a stop message, that affected the java script. Hence I tried using URLEncode just to display any invisible characters to me.If I then put code in place to replace the non visible characters and decode it again, the message displays.
The problem is that there are all sorts of variable messages that come back from the 3rd party, and I don't know what all of the possible characters are that I need to replace.
I need to find some way of stripping out any non visible characters.
Your suggestion of using _unescape unfortunately doesn't seem to work in this instance.
I was wondering if I should do a brute force loop through each character in the error message checking it's CHR value, and replacing the it if it fell outside of a specific range, but I'm not sure what that range might be, as I'm not really sure what it is exactly that is screwing up the java.
Does that sound reasonable?
Regards,
Neil.