On form change

Posted on 2007-11-22
Medium Priority
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
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
  • 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???
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 46

Accepted Solution

Sjef Bosman earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

  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…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

801 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