A
AsZe
Hi
I really did try to keep this short but I'm notoriously bad at writing
anything short, so...
Okay, so the situation is as follows: there's a page with a list of
textboxes (varying amount of them), and we want to control the length
of the text that goes into each of them (the textboxes all have the
same max size of content). I know, I know, it's been done in 50-
zillion ways already. But, our version has a twist!
You see, the data from these textboxes then fills some fields in PDF
forms. These fields are kinda like divs with a specific width and
height set - and we want to make sure that anything accepted by the
form will look good on the PDF form, that is, fit in those fields.
For the sake of the explanation, let's imagine we have a PDF field
that accepts 3 rows of text by 60 columns.
Consider the following text:
Lorem ipsum dolor sit amet. Consectetuer adipiscing elit,
maecenas ac magna a dolor iaculis pretium. Pellentesque
interdum. Nunc ut arcu. Proin porta feugiat urna.
This is roughly 162 characters, all in one long line that wraps into 3
lines. It'll be accepted by most any JavaScript textbox-length-
checker, and rightly so, since it'll look okay on the finished PDF.
Now, consider this text:
Lorem ipsum dolor sit amet.
Consectetuer adipiscing elit, maecenas ac magna a dolor
iaculis pretium.
Pellentesque interdum. Nunc ut arcu.
Proin porta feugiat urna.
This is the exact same text - so still 162 characters - but there's 3
newlines in it, which makes the text span 5 lines in all. We don't
want to accept this one, since it'll mess up the whole PDF form.
I know how I could write the code in PHP, but that's useless since I
want it to check the length _before_ the form content is submitted.
The problem is my knowledge of JavaScript is pretty much nonexistent -
I can change variables and stuff, but overall, I'm total rubbish at
it. Hence why I'm asking for help here.
Thanks in advance,
Alicja Z.
I really did try to keep this short but I'm notoriously bad at writing
anything short, so...
Okay, so the situation is as follows: there's a page with a list of
textboxes (varying amount of them), and we want to control the length
of the text that goes into each of them (the textboxes all have the
same max size of content). I know, I know, it's been done in 50-
zillion ways already. But, our version has a twist!
You see, the data from these textboxes then fills some fields in PDF
forms. These fields are kinda like divs with a specific width and
height set - and we want to make sure that anything accepted by the
form will look good on the PDF form, that is, fit in those fields.
For the sake of the explanation, let's imagine we have a PDF field
that accepts 3 rows of text by 60 columns.
Consider the following text:
Lorem ipsum dolor sit amet. Consectetuer adipiscing elit,
maecenas ac magna a dolor iaculis pretium. Pellentesque
interdum. Nunc ut arcu. Proin porta feugiat urna.
This is roughly 162 characters, all in one long line that wraps into 3
lines. It'll be accepted by most any JavaScript textbox-length-
checker, and rightly so, since it'll look okay on the finished PDF.
Now, consider this text:
Lorem ipsum dolor sit amet.
Consectetuer adipiscing elit, maecenas ac magna a dolor
iaculis pretium.
Pellentesque interdum. Nunc ut arcu.
Proin porta feugiat urna.
This is the exact same text - so still 162 characters - but there's 3
newlines in it, which makes the text span 5 lines in all. We don't
want to accept this one, since it'll mess up the whole PDF form.
I know how I could write the code in PHP, but that's useless since I
want it to check the length _before_ the form content is submitted.
The problem is my knowledge of JavaScript is pretty much nonexistent -
I can change variables and stuff, but overall, I'm total rubbish at
it. Hence why I'm asking for help here.
Thanks in advance,
Alicja Z.