Field length

Hi all,

How can I prevent the length of a field.

It’s quite usual the user put in the subject field the description of the problem. So, I’d like to prevent this.

I have tried @length formula, but it doesn’t work.

If > 20, then @failure, or something like that.

Thanks.

Subject: Field length

@If((@Length(@ThisValue)>5);@Failure(“String too long”);@SUCCESS)

Andrew.

Subject: Field length

Hello David,

Write the following formula in your Input validation event of the field

@If(@Length(@ThisValue)>20;@Return(@Failure(“Length greater than 20”));@Success)

It checks the length, and if it is greater than 20, prompts an error message.

The formula will fire only when you try to save the form.

You can also use

length:=20;

@Left(@ThisValue;length);

in the input translation event of the field. It won’t prompt the message but will only keep the first 20 characters (or the length you specify in the length variable) in the field.

Hope this helps.

Best Regards,

Munish Kaushik

Subject: RE: Field length

I have done it, but it doesn’t work.The formula doesn’t evaluate it when I change the focus field.

Subject: RE: Field length

Hi,

Input translation formula will evaluate on form refresh not on onblur/ onChange event.

If you want to do that, write follwoing code on onBlur event of the field.

Sub Onblur(Source As Field)

Dim WS As New NotesUIWorkspace

WS.CurrentDocument.Refresh

End Sub

Best Regards,

Munish Kaushik

Subject: RE: Field length

Ok, great, Many thanks.

but, another pop error message when I change the field.

“@Commands and other UI functions are not allowed in this context”

arghh!!! Sorry.

Subject: RE: Field length

Hello David,

I’m not able to reproduce your problem but there must something that’s causing the error. Request you to check all your @formula or @commands.

Refer this link as well, see if it helps you…

http://www-10.lotus.com/ldd/nd6forum.nsf/0/d0b0840300242d7b85256e6f006c6849?OpenDocument

Best Regards,

Munish Kaushik

Subject: RE: Field length

Ohhh yes,That’s it.Many thanks, I had a wrong code in another field.