On form change

Posted on 2007-11-22
Last Modified: 2013-12-18
I am new to Lotus Notes programming, What i have done is creating a form.
This form has a checkbox and another text field.  What I want to do is Write the name of the user who clicks on the check box, so checks it.
What will be the code and where I need to run this code.

Question by:damixa
  • 5
  • 2
LVL 46

Expert Comment

by:Sjef Bosman
ID: 20335043
Is this in Notes or in a browser?

Let's suppose those are the only two fields on the form. The one who checks the checkbox is also the one who saves the document. You could therefore add some code to the QuerySave-event.

What you can also do is add code to the Entering-event of the checkbox-field; An example:

Dim ws As New NotesUIWorkspace
Dim ns As New NotesSession
Dim doc As NotesDocument

Set doc= ws.CurrentDocument.Document
Call doc.ReplaceItemValue("TextField", ns.CommonUserName)

Author Comment

ID: 20335355
The form will have more than one check box and for each of them will be a text field next to eat.
Will be more like a check list that makes so that who checks the point will write the name next to the check point. but probably a loop will do the trick.

Author Comment

ID: 20339003
when in the form are there more than 1 checkbox ur code doesnt work,.
shouldn't be there a place checking if the checkbox is checked???
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

LVL 46

Accepted Solution

Sjef Bosman earned 500 total points
ID: 20342198
Code works, but you have to put it in EVERY checkbox's Entering-event. Since you didn't say that some action was required when the checkbox was already checked, I left that out. You can add it of course, here's an example:
Set doc= ws.CurrentDocument.Document
If doc.CheckboxField(0)<>"" Then 
	MsgBox "Already checked"
	Call doc.ReplaceItemValue("TextField", ns.CommonUserName)
End If

Open in new window


Author Comment

ID: 20356463
Hej Sjef
Thanks for the code, its does do the trick but i have this problem, when you check the checkbox, it writes u the name, but in case you uncheck it , nothing happens, and in your code, i tried in different ways but it looks like it never enters the first if doc.checkboxfield(0)="" then it always jumps to the else
i wanted that when you check it writes the name, which it does when you uncheck it writes " " or sth else.

Author Comment

ID: 20365421
Another problem i just realized,
when you use the tab key it again writes the name in the next field, so i suppose this formula doc.checkboxfield is doing something wrong, shouldnt be there sth like is checked or similar..


Author Comment

ID: 20449759
thanks for trying...

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to access Names.nsf DB from a C# application 14 1,531
Email Message Background Color 4 133
Lotus Notes Mail Database issues 2 926
Disable Return Receipt In Lotus Notes 15 252
This is an old article, please see an updated version of this article, located here:
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
In a recent question ( here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

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