[thelist] JS and ASP working together - a problem

Dunstan Orchard dunstan at 1976design.com
Thu Jun 26 16:41:09 CDT 2003


Hi there,

I'm having a problem with ASP and JavaScript working together.

I'm grabbing data from a DB using ASP, looping through each value, building a 
concatanated string, formatting it into HTML lists and then passing this HTML 
through a JS script to be displayed on a page (it's a simple syndication 
system).

It works fine with 99% of my information, but one DB field is giving me 
problems.

This section of the HTML is a list of personal trainer's qualifications, and 
the data returned looks like this example:

CSCS, NSCA-CPT, ATC, ACSM-HFI, PHTLS-P, ACLS-P, RSFA, BLSHCP

or:

NSCA - CPT, CSCS; ACSM H/FI; NASM - PES; ACE - CPT; AFAA; AEA

If I leave this information out (i.e. don't insert the relevant ASP variable) 
when I'm building my concatanated HTML string then the page displays fine (the 
JS works).

If I include the ASP variable for this field when I'm building my concatanated 
HTML string then the JS fails.

If I manually insert the exact same characters that I typed above into the 
concatanated string, then the JS works. The same occurs if I set the 
qualification variable to this value manually (i.e. don't make the DB call).

So it seems that by asking ASP to insert this information, even though it's 
exactly the same info, makes the JS fail. If I just ask ASP to display the 
HTML string I've built then it displays it perfectly every time - it's not 
bothered by the inclusion of this info.

All rather odd.

The JS error I get speaks of an 'Unterminated string constant'.


Can anyone understand what I'm saying, and offer a solution as to what might 
be happening?


Many thanks - Dunstan

P.S. can't show working examples since the dev site is PWD protected.

---------------------------
Dorset, England
http://www.1976design.com/
http://www.orchard.it/
http://www.maccaws.org/


More information about the thelist mailing list