Jump to content

This topic is 8378 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hoping the guru's can help with this one...

I'm trying to create a validation that will limit the amount of text (word/characters) in a description field. No problem, I can do that one.

My hang up is when the user adds a " par.gif " and starts a new line (yes, it has to be able to happen).

How can I take into account for the remainder of characters on a line that would otherwise be there if there were no " par.gif "? The field is also multi-lined, so it could contain several hard returns that need to be accounted for.

I envision making some sort of calculation that totals to a set amount then the description field validates against that number. What's that? I think I can already hear the chuckles...

Hope this makes some sense to someone somehow.

Thanks in advance.

Posted

Thanks for the input Vaughan, but not quite what I need. I don't want to remove the <cr> from the input, rather, I need to account for them.

Let's say user "A" enters a 3 or 4 word feature/description, then a <cr>, plugs in another 4 or 5 words, another <cr> & continues as such making 10 short lines in the field.

Then there's user "B" who likes to be very wordy in their descriptions. The first feature/description they type wraps 3 times in the field before they finally enter a <cr>, then they do another line in the same fashion, and then another...

The goal is that the last line of text falls in the same place on the printed form for both users without anything being truncated in the field.

I'd like to somehow count the typed characters on the left side of the <cr>, subtract that from the known field width and be able to work some kind of tally that says a limit has finally been reached, even though in truth, it may not have.

Alternately, I could try to teach users that "this is just about all the space you have...". But, that may even be harder than the validation I'm looking for... wink.gif

Thanks!

Posted

Jim

Easiest method: give the user a layout with a set amount of field space on it. Tell the user their text MUST fit within the space. Let them sort it out.

Anything else is geting into the realm of AI.

Posted

quote:

If that's the case, the Vaughan's solution is the right one for you.


Thanks for your input Chuck, and I do understand what you are saying, but that's not what I'm looking for...

Let's say you have a field on your layout that's roughly 25 characters wide and 10 lines tall. Without any <cr>, you should be able to get nearly 250 characters in the field, give or take. I could just set the validation to ">250" and call it a day.

My problem is, what if the user places a <cr> at the 10th character of the 5th line to start a new line of text. That would allow them to enter 11 lines of text with 14 characters on the "hidden" line before the validation would kick in, thus cutting of some of the printable description. I need a way to compensate for the <cr> and missing 14 characters on that line and apply them towards my total count of 250.

I think Vaughan's follow up post is pretty much on the nose. I am just trying to be thorough before I return to the user who requested the "feature" and laugh in their, err, tell them it's a no go.

Thanks for your help, gents!

Posted

Sounds like you need to count all the characters up to the par.gif , then divide by your line width (e.g. 25 was your example) and get the remainder with the Mod() function. Subtract that from the width to get the "missing" length:

25 - Mod(Position (theText, par.gif , 1), 25)

Now multiply that result times this:

PatternCount(theText, par.gif )

All done. But here's a crazy idea -- how about just putting a copy of the field in its final formatted state next to the entry field, or on another layout, whatever, and the user can just click a button and "preview" how it will look?

Posted

If you are just worried that some of the text will get cut off at the bottom of the field, there is actually an automatic technique to test this. But, it involves executing a script. So, it would have be triggered by a button that the user clicks when finished entering the record data. If this acceptable, I can give you the details.

<Hint: it's totally warped!>

Posted

I'm afraid that I'm still not clear on exactly what it is that you want. Do you want there to be a limit on the number of characters that a user can enter, but not have carriage returns count toward that total number of characters?

Say the limit is 10 characters. So "abcdefghij" is legal, but if there's a return character in the middle, such as "abcde

Posted

Help from all angles, I love it!

quote:

But here's a crazy idea -- how about just putting a copy of the field in its final formatted state next to the entry field, or on another layout, whatever, and the user can just click a button and "preview" how it will look?

Fitch - Thanks for the "crazy suggestion", but if it were really just that easy, that's what I would have done. The group of users that will be posting the data for that field are "artsy visionaries" who have minimal technical savvy with monitors usually set to 640 x 480. I just don't have the real estate for that luxury...

Chuck was kind enough to email me something the other night that gets me going, though it does need some work. Once I can get it to do what I need reliably, then I'll post a follow up here.

quote:

<Hint: it's totally warped!>

Bob - I'm open to anything that may solve my problem, "warped" (I assume that's a play on "total wraps"?) or not. I'd love to hear what you have to share, either here or via email.

Again, thanks for everyone's input. You (again) got me back on track.

Posted

quote:

Let's say you have a field on your layout that's roughly 25 characters wide and 10 lines tall. Without any <cr>, you should be able to get nearly 250 characters in the field, give or take. I could just set the validation to ">250" and call it a day.

My problem is, what if the user places a <cr> at the 10th character of the 5th line to start a new line of text. That would allow them to enter 11 lines of text with 14 characters on the "hidden" line before the validation would kick in, thus cutting of some of the printable description. I need a way to compensate for the <cr> and missing 14 characters on that line and apply them towards my total count of 250.

I think I have a solution which solves your problem. I am interested to hear what the seasoned forum guys think. Yes, i know its a massive calculation, but I am sure the logic is correct.

If the following calculation returns a value of 10 or more then the text field will be invalid:

If(Length(Text) - Position(Text, "

Posted

The method of measuring a text field that I talked about earlier involves having the field sitting across a page break, going into preview mode, and counting pages. Since there are a lot of details that have to be handled correctly, it's easier to just give you an example. Here is a sample file Mac .sit version and Windows .zip version

Posted

Bob - Thanks for the link. You're right, it's a bit warped, but quite useful none the less. I will add it to my arsenal for later use.

Peter - I was actually able to get your method to do what I needed with a little tweaking. It's a bit kludgey, but it does get the job done reliably. Once I have an opportunity to sort it all out & document it, I'll post the details. I owe you a big one! That was truly worth a star.

Again, many thanks to the masters. My users are once again happy... And so am I.

[ February 25, 2002, 11:40 AM: Message edited by: Jim Mitchell ]

This topic is 8378 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.