PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/ __________________________________________________________________


Am Dienstag, 13.01.04, um 21:25 Uhr (Europe/Brussels) schrieb Lauterbach.Mark:


P.S. I guess it would be a little excessive to write logic that would
carry over the last partial word typed in by the user (for that True
Wrapping feel).

Hi Mark,

I did something a bit like what you're describing on a form which was originally supposed to be filled out by hand. So a lot of spaces ran over two lines. In this example you got a field 3.4, which carries over to field 3.5 in the next line. Here's the script that is being called when the user leaves field 3.4:


ZZ4 = 11 // count of characters which will fit in 3.4 - // this I set using a lot of w and capital letters // trial and error, not very elegant ;-) test_4 = this.getField("3.4"); test_5 = this.getField("3.5"); text4 = test_4.value; laenge = text4.length;

if (laenge > ZZ4)
{
leer = text4.indexOf(" "); // location of the first space between words, if any


if ((leer > ZZ4) || (leer =="-1")) // Wenn kein Leerzeichen da ist ODER das erste Leerzeichen schon nicht mehr ins Feld passt,
{ // kommt der ganze Text ins zweite Feld


                        test_5.value = event.value;
                        test_4.value = "";
                }
        else
                {

                        for (i = 0; i < ZZ4; i++)
                                {

                                 if (text4.charAt(i) == " ")
                                 {
                                 leer = i;

                                }
                                }

                        test_5.value = (text4.substring((leer + 1), (laenge)));
                        test_4.value = (text4.substring(0, (leer)));
                }
        }
else  // Der Text passt ins erste Feld, also lassen wir das zweite leer
        {
        test_5.value = "";
        }
Excuse me for not translating all the comments.
Hope this is of interest.
Cheers, Stefan


To change your subscription: http://www.pdfzone.com/discussions/lists-pdfforms.html



Reply via email to