[Zope] Problem with zope and long strings

Jonathan Hobbs toolkit at magma.ca
Fri Aug 6 08:55:25 EDT 2004


----- Original Message -----
From: "kepes.krisztian" <kepes.krisztian at peto.hu>
> My problem is that:
> I want to js.alert with long strings.
> I create these strings, and the complete js code.
> But zope is wrapping my strings like that:
>
> <script>
> function aaa{
> jscode...
> s="xxxxxxx ........
> ";
> jscode...
> };
> </script>
>
> Everytime it is do that, so I cannot prevent that. But this format the
> JS interperter is making errors.
>
> Please help me: how to prevent the long string wrapping ?

I don't know how to prevent zope from 'wrapping' your strings, but if
somehow a newline character is being inserted within your strings, then you
could write a js function to remove the newline character before you call
'alert'.

Here is a quickie js replace function you could modify...

function replaceString(oldS,newS,fullS) {// Replaces oldS with newS in the
string fullS   for (var i=0; i<fullS.length; i++) {      if
(fullS.substring(i,i+oldS.length) == oldS) {         fullS =
fullS.substring(0,i)+newS+fullS.substring(i+oldS.length,fullS.length)      }
   }   return fullS}


HTH

Jonathan




More information about the Zope mailing list