Solved

On form change

Posted on 2007-11-22
7
251 Views
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.

thanks
0
Comment
Question by:damixa
  • 5
  • 2
7 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
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)
0
 

Author Comment

by:damixa
Comment Utility
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.
0
 

Author Comment

by:damixa
Comment Utility
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???
thanks.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 500 total points
Comment Utility
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"

Else

	Call doc.ReplaceItemValue("TextField", ns.CommonUserName)

End If

Open in new window

0
 

Author Comment

by:damixa
Comment Utility
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.
thanks
0
 

Author Comment

by:damixa
Comment Utility
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..

thanks
0
 

Author Comment

by:damixa
Comment Utility
thanks for trying...
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
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.
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now