Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Webfocus putting line breaks in my html/js code
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Webfocus putting line breaks in my html/js code
 Login/Join
 
Member
posted
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


Here is the html code with line breaks:

<A onclick="loadXML('<col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld><fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld><fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld><fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld><fld>RAND_NO</
fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld><fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld><fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld><fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld><fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><
opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld><fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld><fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld><fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld><fld>RAND_NO</fld></col>')" href="javascript:void(0);">LGE1</A>


Thanks.

This message has been edited. Last edited by: Kerry,


WebFOCUS 7611
Windows XP Pro
 
Posts: 11 | Location: Nottingham, UK | Registered: February 27, 2009Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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:
<A onclick="loadXML('<col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld>'+
'<fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld>'+
'<fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld>'+
'<fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld>'+
'<fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld>'+
'<fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld>'+
'<fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld>'+
'<fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld>'+
'<fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld>'+
'<fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld>'+
'<fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld>'+
'<fld>RAND_NO</fld></col><col><fld>CENTRE</fld><fil><opt>5</opt><val>082000200</val></fil></col><col><fld>PATIENT</fld>'+
'<fld>RAND_NO</fld></col>')" href="javascript:void(0);">LGE1</A>
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 7 - IE11.
in Focus since 1988
 
Posts: 1960 | Location: Netherlands | Registered: September 25, 2007Reply With QuoteReport This Post
Member
posted Hide Post
I'll have a go, thanks. Not sure how. The xml string is going to be of variable length.


WebFOCUS 7611
Windows XP Pro
 
Posts: 11 | Location: Nottingham, UK | Registered: February 27, 2009Reply With QuoteReport This Post
Member
posted Hide Post
EDITXML/A4000V = PARAG(4000, XML, '''+''', 400, EDITXML);

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
 
Posts: 11 | Location: Nottingham, UK | Registered: February 27, 2009Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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.


GamP

- Using AS 8.2.01 on Windows 7 - IE11.
in Focus since 1988
 
Posts: 1960 | Location: Netherlands | Registered: September 25, 2007Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Webfocus putting line breaks in my html/js code

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.