Link to home
Start Free TrialLog in
Avatar of damixa
damixaFlag for Denmark

asked on

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
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

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)
Avatar of damixa

ASKER

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.
Avatar of damixa

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of damixa

ASKER

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
Avatar of damixa

ASKER

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
Avatar of damixa

ASKER

thanks for trying...