Link to home
Start Free TrialLog in
Avatar of Rob101
Rob101

asked on

Flash, Forms and LINE BREAKS

I'm using FLASH on my ASP site and am having a small formatting problem.

Any help would be much appreciated.

I have a flash input box on one page. It submits to another page (with another flash form) where users can Verify what they typed in before they submit it.

My problem. - How can I keep the Line Breaks between pages?

On the first form the content is entered like this…

“Hello world

Hello again”

But after I submit it to the second flash form (dynamic text box with variable) it looses all of its formatting and ends up like “Hello worldHello again”

Any Ideas?

Multiline is ON in the flash files..
Form is submitting with ‘get’ action.

I guess in short what I'm trying to do is Submit one flash form to another while keeping all paragraph breaks.

gawd it's urking me.

thanks
Rob101
Avatar of elhy
elhy

do you mean this?:

- page1.asp contains the input box.
- page2.asp contains another flash form
- you passed the values of the input box to page3.asp then pass back to page2.asp?

or

- you passed the values of the input box straight to page2.asp?
- How did you do your passing of variables?
- What method did you use when passing the values? "GET" or "POST"?
hi Rob101,

if u are having a page only for user confirmation u don't have to submit to another file

1) page1.asp -> flash form (input fields - text boxes) -> "submit" button goes to another frame -> flash text (static label only) -> confirm (this does the real submit) -> page2.asp

2) did u escape the text before u send it? if not it will disappear in the querystring, escape the text "CR" becomes %0D then u have to play around with it depends on where u going to save it, u can do replace(formText,"%0D",vbcrlf) etc ...

3) use "POST" instead. (u will still have to play around with CR/LF etc, flash uses only CR for newline, asp(windows) cr/lf combine.)

have a try and see :)

cheers
Avatar of Rob101

ASKER

Hi all

Thanks for your time..

Here is how I have it set up.

I have 2 asp pages. Each with a flash form. I’m trying to send the contents of one input box to another without loosing the formatting.

henryww -  I’ve tried replacing the line breaks with the code below and no luck.

<%= Replace(Request.Form("TextInfo"), "vbCrLf", "%0D") %>

is that about right? I’ve had no luck replacing any line breaks so far but I think I must be close. I’m getting the %20 spaces, but still no line breaks.

My first flash form is named TextInfo and submits with post.

My second flash form has the code below add to it.

 <embed src="../images/PrintTextBox.swf?textInfo=<%= Replace(Request.Form("TextInfo"), "vbCrLf", "%0D") %>" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="576" height="756">
    </embed>

I have a Dynamic Text Box on my second page with a Variable Name called Text Info.

Doh. Little hair left to pull out!

Any other suggestions?

Thanks in advance all!
<%= Replace(Request.Form("TextInfo"), "vbCrLf", "%0D") %>
u got this the wrong way round!!??
the correct syntas should be

replace(request.form("TextInfo"),"%0D",vbcrlf)
vbcrlf - NO QUOTE, it is built-in for cr/lf

BUT ... since u are passing it again back to another swf...
using querystring like xxx.swf?.... here u don't have to replace the %0D ...

well, i still don't know why u have to use 2 asp & 2 swf for the confirmation, but i suppose there must be a reason u have to do it that way....

now ... can u get the text in the second flash ...?
since i don't haven't seen ur code and don't know what exactly it looks like, so it is a bit hard to guess what it goes wrong...

is there a link to the files??

u can also do a very simple test here
txt = unescape("This+is+line1%0Dand+this+is+line2");
have a dynamic text box set the variable to txt
and u will get 2 lines ...

<.... >
<PARAM NAME=movie VALUE="Untitled-1.swf?txt=This+is+line1%0Dand+this+is+line2">  
<... >
<EMBED src="Untitled-1.swf?txt=This+is+line1%0Dand+this+is+line2" ....>
<... >

i just did that exact same thing to a swf with a dynamic text box variable is txt ... and it works fine ... got 2 lines

a few steps to debug

1)in page2.asp check the post from the 1st asp page1.asp
make sure u get the correct result ...
if u escape the text before it is post that's ok, u can also escape the text within asp using server.URLEncode("string") ... response.write it somewhere u can see...

2)check the "Dynamic Text Box on YOUR second page " and see if it has multiline on

3)can u see the textinfo on ur second swf??? without newline??

post more code or give me a link to the files :)

cheers
remember u don't have to replace the "%0D" the way u are passing variables ... u don't have to replace anything ... it is the correct format ... :)

just in case i didn't explain it well ...
Avatar of Rob101

ASKER

Wow, thanks for all your help. It helps HUGE.

After doing a few tests from your above code, I can see that my original form is SENDING plain characters. No %20, or + chars.

I put the “This+is+line1%0Dand+this+is+line2” and it worked. Kewl! (thanks)

But how can I encode the form contents leaving my first form? I can see that
“Big Bad Dog” goes to “BigBadDog” as soon as I submit it. Hmm I’m trying not to get confused here but it might be too late. Been trying to many things. But everything you suggested makes total sense.

How is it I am getting this wrong? One flash form submits to another!??
The characters that are passed to the second page have no formatting (BigBadDog) so the server.URLEncode("string") won’t work.

I must have a problem(?)  On my first form. I’ll go look again.

Thanks again for your help and time.
in ur 1st file / 1st flash

say u have the same textinfo to send to page2

then u will do

textinfo = escape(textinfo);

before sending the data ...

but i still don't know why u want 2 flash ... just to confirm?

no there is nothing with with 2 flash 2 forms 2 asp page, is just that if the sole purpose of the 2 swf if to let user confirm what they had entered ... why don't you just have an extra frame for the confirmation ... merget the 2 flash together, have 1 asp only ... ok ...

// frame X
where u have the from, and all the input boxes
stop(); here
a button to "sumbit" or "confirm" etc the goto the X+N frame

//frame X+N (n frames later .. not sure what u want to do in between ...)
then here u display all the information again, change the input boxes to dynamic text boxex only so user can't change here ... then have a button for them to go back to change in frame X (on(release) gotoAndPlay(X);

another button to do the actually submit ...

so to save u from posting from form1 to from2 and back & forth ... user also don't need to re-enter everything, it is already there. they only need to change what they need to change ...

... .. .. ..

maybe u do have a peculiar reason for that .. i am not sure ...

Avatar of Rob101

ASKER

Wow, thanks for all your help. It helps HUGE.

After doing a few tests from your above code, I can see that my original form is SENDING plain characters. No %20, or + chars.

I put the “This+is+line1%0Dand+this+is+line2” and it worked. Kewl! (thanks)

But how can I encode the form contents leaving my first form? I can see that
“Big Bad Dog” goes to “BigBadDog” as soon as I submit it. Hmm I’m trying not to get confused here but it might be too late. Been trying to many things. But everything you suggested makes total sense.

How is it I am getting this wrong? One flash form submits to another!??
The characters that are passed to the second page have no formatting (BigBadDog) so the server.URLEncode("string") won’t work.

I must have a problem(?)  On my first form. I’ll go look again.

Thanks again for your help and time.
ASKER CERTIFIED SOLUTION
Avatar of henryww
henryww

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rob101

ASKER

wow. what a long time that took me. And i like to think of myself as a knowledgeable coder. Ouch. I’ve formatted content from databases, text files etc, but never with that much trouble. I followed your tips on the replace method and new I was close. Then I tried..

  <%
  comm=request.querystring("Tbox")
  comm=replace(comm,CHR(13),"%0D")
  %>

and it worked! The CHR(13) is what worked here. Why? Don’t know. (well I do know why it worked, just don’t understand why your code did not) Doh.

You totally helped. Thanks for your ideas and suggestions. Without them I would not have gotten it going. Cheers to you dude!

peace!

Rob101
chr(13) = vbcr

hmmm ... that's interesting ... i would like to see ur source too and to see why it wouldn't work with the original script.... interesting ....

it shouldn't be a very hard problem... but u never know as it turned out....

thanks & cheers