[CLOSED] Webfocus putting line breaks in my html/js code
Hi, I am trying to build a onClick function into a hyperlink that passes some XML to a javascript function. The XML is stored in a database and is up to 4000 characters long. There should be no limit to the length of string you can pass through to javascript using the onClick() function, however I am getting the js error "Unterminated string constant". When I view the source I can see that line breaks have been put in to the string after a certain amount of characters which is causing this error. I have tried using the nowrap on the table cell which didnt work. Has anyone got any ideas to help or seen this before? By the way under around 482 characters works fine because it stays on the one line.
Here is some of my fex code:
DEFINE FILE H1
NAMELINK/A4000V = '<a href="java_script:void[0);" onclick="loadXML[''' || XML || ''')">' || NAME || '</a>';
END
TABLE FILE H1
PRINT
NAMELINK AS 'Name'
ON TABLE SET PAGE-NUM OFF
ON TABLE &HoldType AS NODESS10 FORMAT HTML
ON TABLE SET EMPTYREPORT ON
ON TABLE SET STYLE *
TYPE=REPORT, WRAP=OFF, $
ENDSTYLE
END
Thanks.This message has been edited. Last edited by: Kerry,
WebFOCUS 7611 Windows XP Pro
September 28, 2010, 03:30 PM
GamP
There may not be a limit to what you can pass in javascript (and I have seenjavascripts of over 20000 characters, so that statement is quite true), but there may very well be limits to what WebFOCUS can process in one line of code. Would it be possible for you to code your javascript as follows:
That way WebFOCUS won't have any problem with it, the javascript still runs and your code is a bit moer manageable. Win-win-win situation I'm thinking...
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
September 29, 2010, 05:03 AM
LEnderby
I'll have a go, thanks. Not sure how. The xml string is going to be of variable length.
wont work because webfocus doesnt like me passing quotes in to the function. Same with STRAN.This message has been edited. Last edited by: LEnderby,
WebFOCUS 7611 Windows XP Pro
September 29, 2010, 08:21 AM
Alan B
Luke
This is WebFOCUS limiting the HTML line length to 512. Remember the blinding over the HTML, an A512 was used.
Let me see what we can come up with.
Alan. WF 7.705/8.007
October 05, 2010, 03:00 PM
GamP
just thought I'd run this in 7.7.01. Guess what? It just runs, no discernable limit on the html lines. I created a code line with over 2700 characters, and it still was put on one line, no breaks. So, I'd advise to upgrade to 7.7.01, that should take car care of this problem anyway.