Solved

On form change

Posted on 2007-11-22
7
258 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
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)
0
 

Author Comment

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

Author Comment

by:damixa
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???
thanks.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 46

Accepted Solution

by:
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"
Else
	Call doc.ReplaceItemValue("TextField", ns.CommonUserName)
End If

Open in new window

0
 

Author Comment

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

Author Comment

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

thanks
0
 

Author Comment

by:damixa
ID: 20449759
thanks for trying...
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
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 shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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