Re: Moving a string from VBScript to JScript

From: Viatcheslav V. Vassiliev (msnewsgroup_at_www-sharp.com)
Date: 06/18/04


Date: Fri, 18 Jun 2004 13:08:59 +0400

If I am not wrong, Martin suggested replace carriage returns with \n (escape
sequence for carriage return). If your script is in JScript, now you have
(after executing ASP):

document.Form1.Text.value = 'some text
that continues on next line';

You should have (next line has no breaks):

document.Form1.Text.value = 'some text\nthat continues on next line';

//------------------------------------
Regards,
Vassiliev V. V.
http://www-sharp.com -
Scripting/HTA/.Net Framework IDE

"Roger Withnell" <rogerREMOVE@THISFIRSTupperbridge.co.uk> сообщил/сообщила в
новостях следующее: news:caq9td$mka$1@titan.btinternet.com...
> Thanks for all the help.
>
> I tried using the hidden <div>, Viatcheslav, which avoided the error, but
> the conversion lost the carrier return.
>
> I didn't understand Martin's answer. If I had, it looked like the simplest
> solution.
>
> I fixed it by using RegExp in VBScript to change the carrier return to a
> string of characters (I used "zYz") and then used RegExp in JScript to
> convert "zYx" back to a carrier return. Cumbersome, but it works.
>
> Martin, if you see this, please help me with your solution. Clearly more
> efficient.
>
>
> "Viatcheslav V. Vassiliev" <msnewsgroup@www-sharp.com> wrote in message
> news:usyCNUsUEHA.3944@TK2MSFTNGP12.phx.gbl...
> > Could you place <%= SurveyUpdateRS("IntraText") %> into HTML code, not
> > script, such as
> >
> > <FORM action="..." method="POST">
> > <% Response.Write(SurveyUpdateRS("IntraText")) %>
> > </FORM>
> >
> > Or place it into hidden DIV and then use myDiv.innerText (or innerHTML).
> >
> > //------------------------------------
> > Regards,
> > Vassiliev V. V.
> > http://www-sharp.com -
> > Scripting/HTA/.Net Framework IDE
> >
> > "Roger Withnell" <rogerREMOVE@THISFIRSTupperbridge.co.uk>
сообщил/сообщила
> в
> > новостях следующее: news:camg9u$2bf$1@titan.btinternet.com...
> > > But I'm using the carrier return to format the text when it is
> displayed.
> > >
> > > Any other thoughts? Or should I substitute the carrier return with
> > > something else with which to format the text?
> > >
> > >
> > > "MikeB" <m.byerleyATVerizontDOTnet> wrote in message
> > > news:OLss04mUEHA.3420@TK2MSFTNGP12.phx.gbl...
> > > >
> > > > "Roger Withnell" <rogerREMOVE@THISFIRSTupperbridge.co.uk> wrote in
> > message
> > > > news:calbva$8e5$1@titan.btinternet.com...
> > > > > I'm using:
> > > > >
> > > > > document.Form1.Text.value = '<%= SurveyUpdateRS("IntraText") %>';
> > > >
> > > > I ran into this a couple of years ago. In my case the solution was
to
> > > strop any
> > > > CR from the text before saving to the DB as part of the validation
> > before
> > > > submit.
> > > >
> > > > > to set a form value from a recordset.
> > > > >
> > > > > This works fine unless "IntraText" includes a carrier return.
Then
> > the
> > > > > whole jscript routine fails.
> > > > >
> > > > > Please advise.
> > > > >
> > > > > Thanking you in anticipation.
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: finding out user
    ... It looks like when I pasted the code into the post, many carriage returns ... Your error message will indicate the line number in the script ... If you aren't used to this it can be tricky, but the error message should ... filter user objects. ...
    (microsoft.public.win2000.active_directory)
  • Re: How to use "Checkbox set" in script
    ... >>> I have tried to find out what you mean and how to use it in a script, ... particularly removing a check but I have tested this and it ... The first inner if End If checks that the value is not ... > single checked box does not have a carriage return in the field. ...
    (comp.databases.filemaker)
  • Re: Can not save Normal.dot error when automating Word from VBScript
    ... "Viatcheslav V. Vassiliev" wrote in message ... > already open in Word before starting script. ... > set doc = word.Documents.Add ... > set rng = nothing ...
    (microsoft.public.office.developer.automation)
  • Re: Problem with Applescript PASTE function in MS Word
    ... > gotten the script from George Clark on this or another board, ... "quotes") now contains Unix Linefeeds rather than Mac Carriage Returns, ... now the VB Editor is not seeing them as separate lines. ... change that vbLf to vbCr it just might fix it. ...
    (microsoft.public.mac.office.word)
  • Re: Net::Telnet and SMTP
    ... > carriage return after a command in order to get the result of the ... > i have been content with just sending carriage returns.. ... about with my full script. ... with perfectly interspersed commands and responses, ...
    (comp.lang.perl.misc)