6 Replies Latest reply on Dec 16, 2009 7:47 AM by kglad

    Enter Text field and line breaks?

    luciewong Level 1

      Hi,

       

      I have a input textfield 200x150 where customers can write their address.

       

      Problem:

      Address is written like:

       

      Avenida de presidente

      Calle no 2

       

      //**************************

       

      The text arrives in my database as:

       

      Avenida de presidenteCalle no 2

       

      How can the line break be recognized in the Text field, so the text arrives in the format as written?

      The text field also has a >restrict<, it does not allow " , " ;

       

      Thank you for your help.

      Lucie

        • 1. Re: Enter Text field and line breaks?
          kglad Adobe Community Professional & MVP

          the carriage return character is "\r".  if that's not being received in your server-side script, you can substitute (use split().join() ) another character in flash and replace that character in your server-side script.

          • 2. Re: Enter Text field and line breaks?
            luciewong Level 1

            Hi kglad,

            has been a long time talking to you, how are you?

             

            wow, sounds good your suggestion, but....how I write this?

            I have no idea where to start.

             

            Lucie

            • 3. Re: Enter Text field and line breaks?
              kglad Adobe Community Professional & MVP

              hi lw,

               

              in flash, you can use:

               

              yourtextstring = yourtextfield.text.split("\r").join(",,");

               

              then in your server-side script you can convert all double commas into carriage returns.  the code you would use for that depends on your scripting language.

              • 4. Re: Enter Text field and line breaks?
                luciewong Level 1

                Kglad,

                I have a sign-up Form with several input Text fields.

                One of the TFs is >address< which is multiline/wordWrap.

                 

                All Form content goes in 1 array.

                So each Text field represents 1 array element.

                 

                So I have a TF Listener>

                 

                Listener.onChanged = function(txt){

                thetext = txt.text.split(“\r”).join(“..”);

                content_array.splice(theno,1,thetext);

                }

                 

                Works great, whenever I have a break in address for ex. It will put me a “..” into the string.

                My content_array looks then like:

                [aaaa,bbbb,cc..ccc..cccc..cc,ddd,eee] where the “ccc” element is the address field.

                 

                I probably could now manage in my ASP to replace the “..” with ??? what?? Don’t know yet, so the Database could read a line break.

                 

                But…..huah,

                I would guess, that my string for the address field in the Database would look for the moment like> cc..ccc..cccc..cc <.

                But does not, it looks like > ccccccccccc < . So already now also the “..” are taken away.

                That’s bad, isn’t it?

                • 5. Re: Enter Text field and line breaks?
                  luciewong Level 1

                  To those interested,

                  what I did now in my ASP.

                   

                  theContent = replace(Request("value" & i),chr(13),"<br>")

                   

                  my address string looks now in the DB like >> cc<br>ccc<br>cccc<br>cc <. which is much better than before.

                  On return I will then replace the >br< with “\n”.

                   

                  Thankyou kglad.

                   

                   

                  • 6. Re: Enter Text field and line breaks?
                    kglad Adobe Community Professional & MVP

                    you're welcome.

                     

                    if you still can, mark this thread as answered.