Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


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

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[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, 2009Report 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 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report 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, 2009Report 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, 2009Report 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, 2007Report 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 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

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-2020 Information Builders