?
Solved

Limiting the Text field to certain number of characters in Notes Client Dynamically

Posted on 2003-11-17
14
Medium Priority
?
365 Views
Last Modified: 2013-12-18
Hi Experts

Is there any possibility to limit the Text field to a number of characters in Notes Client ?

That is If I decide to have the maximum size of the Text field  to be 10 characters then the user should not be allowed to type 11 th character.

 I dont want to pop up any error but I just want to restrict him from typing further. I know an input validation can be done on the field.

But it can check only when the document is refreshed or saved. But what I want to do is limit the text field size.

Hope you people help me.

Thanks in Advance
Vinothini Kasiviswanathan
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
  • 2
  • +1
14 Comments
 
LVL 19

Expert Comment

by:madheeswar
ID: 9769461
Try Input Translation
0
 
LVL 19

Accepted Solution

by:
madheeswar earned 200 total points
ID: 9769466
And here is the code where I found in notes.net

You can do it like this (place these subs on the Form).
I think this is quite self-explanatory. Change the const "fieldname" statement to the field name you want to control, and the "fieldmaxlen" to the max. length you want to allow to type in:

(Declarations):
Dim elapsedTimer As NotesTimer

Sub Postopen(Source As Notesuidocument)
Dim session As New NotesSession
Set elapsedTimer = session.CreateTimer()
elapsedTimer.Interval = 1
On Event Alarm From elapsedTimer Call elapsedTimerHandler
End Sub

Sub elapsedTimerHandler(Source As NotesTimer)
Const fieldname="subject"
Const fieldmaxlen=30
Dim workspace As New notesuiworkspace
Dim uidoc As notesuidocument
Set uidoc=workspace.currentdocument
s=uidoc.fieldgettext(fieldname)
uidoc.fieldsettext fieldname,Left(s,fieldmaxlen)
End Sub
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9769500
Translation:
@Left(fieldname;4)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 19

Expert Comment

by:madheeswar
ID: 9769569
If you are telling that when the types 11th character, then notes should not accept it, then tis not possible. In Notes client we don't have the event.

We have events on web and we can use Java Script for this.

0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9769575
For Translation:
@If(@length(sendmails_k)>4;@Prompt([OK];"Ur Prompt";"Prompt msg")&@Return(@Left(sendmails_k;4));sendmails_k)
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 9769588
Else use Script in Exiting event.
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 200 total points
ID: 9771076
Notes doesn't support onChange or direct size limits, but you can use an external control, such as the ones that come with MS office, and script it in (moving teh value into a hidden field).
0
 

Expert Comment

by:David777
ID: 9776998
input translation seems not be able to change value realtime, it only proceed on save or refresh. But I remember in notes version 6, it supports onChange event in notes client. I check it....

yes, you can put lotus script/java script under onChange event in notes client as well as web
0
 

Expert Comment

by:David777
ID: 9777001
I don't remember notes support direct field size limits.
0
 
LVL 4

Assisted Solution

by:bhartung
bhartung earned 200 total points
ID: 9907511
You'll have to forgive my inability to recall specifics, but I remember back in Notes 4.5 (circa 1997) we were able to accomplish this if the field was defined in a layout region (layout section?  how the memory fades...)  If that was the case, it was possible to get the window handle for that control and use Win32 API calls to set the window properties (it was probably a SendMessage call) to cause the text control to behave as you wish, where the cursor simply stops dead at the nth character.  Darned if I can remember the specifics, but at least you can take away from this rambling the fact that under certain conditions it has been done in the past.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9909783
bhartung,
Cool tip.  Too bad the thread rotted.
0
 
LVL 4

Expert Comment

by:bhartung
ID: 9912903
The horse is dead, but let's beat it a little more...

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const EM_LIMITTEXT = &HC5

Given hwnd, the window handle for the control inside the layout region, the following example would set the upper bound on enterable/pastable text to 30:

SendMessage hwnd, EM_LIMITTEXT, 30&, 0

I recall that we ran this code any time the control got focus.

Hope this helps anyone poking through the archives at least...
-B
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question