• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

On form change

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
damixa
Asked:
damixa
  • 5
  • 2
1 Solution
 
Sjef BosmanGroupware ConsultantCommented:
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
 
damixaAuthor Commented:
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
 
damixaAuthor Commented:
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
Technology Partners: 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!

 
Sjef BosmanGroupware ConsultantCommented:
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
 
damixaAuthor Commented:
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
 
damixaAuthor Commented:
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
 
damixaAuthor Commented:
thanks for trying...
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now