Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2003-11-17
14
Medium Priority
?
369 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

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.

Question has a verified solution.

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

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

636 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