onChange Simple LS

Can you help me with simple LotusScript, please

I need to put a Lotusscript in onChange event in an Dtae/time field.

The lotusscript is shall do only two things. Put a new value into another field in the document and then refresh the document.

It is simple to do this in formula language

FIELD iLagi := “2”;

@Command( [ViewRefreshFields] ) ;

How can I do this in Lotusscript, Thank you very much.

I am using LN 6.5 on a W2K platform

Regards

Kris

Subject: onChange Simple LS

Hi Kris,

here we go…

Sub Onchange(Source As Field)

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = ws.CurrentDocument

Call uidoc.FieldSetText("iLagi","2")

Call uidoc.Refresh

Call uidoc.RefreshHideFormulas	 'if you need

End Sub

The event is triggered if you leave the field or recalculate the document after changing the content of the field.

Greetings,

Daniel

Subject: RE: onChange Simple LS

I’m trying to do something similar, I want to modify enter a value into two fields based on the OnChange of a Radio Button.

One needs to be populated with today’s date

The other needs to populate with the users name (variable, depending on user i.e., who pushed the button).

The method in this thread seems to only provide a fixed text output. Can you do a date? Can you do a variable text field? Can we add in an If/Then arguement to make it conditional on what the Radio button is changed to?

I’m trying to do something like this:

@if(StatusDR := “Completed”; CompDateDR := @date(now);””);

@if(Status DR := “Completed”; CompByDR ;= @Name([CN]; @UserName;””);

I managed to get this to populate my name:

Sub Onchange(Source As Field)

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = ws.CurrentDocument

Call uidoc.FieldSetText("CompByDr","Clayton")

Call uidoc.refresh

End Sub

But the user changes so this isn’t sufficent.

Any help you could provide would be appreciated.

Thank you.

Subject: RE: onChange Simple LS

Is anyone able to assist with this?

I want to enter a value into two fields based on the OnChange of a Radio Button.

One needs to be populated with today’s date.

The other needs to populate with the users name (variable, depending on user i.e., who pushed the button).

The method in this thread seems to only provide a fixed text output. Can you do a date? Can you do a variable text field? Can we add in an If/Then arguement to make it conditional on what the Radio button is changed to? I’m trying to do something like this: @if(StatusDR := “Completed”; CompDateDR := @date(now);””); @if(Status DR := “Completed”; CompByDR ;= @Name([CN]; @UserName;””);

I managed to get this to populate my name:

Sub Onchange(Source As Field)

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = ws.CurrentDocument

Call uidoc.FieldSetText(“CompByDr”,“Clayton”)

Call uidoc.refresh

End Sub

But the user changes so this isn’t sufficent. Any help you could provide would be appreciated. Thank you.

Subject: RE: onChange Simple LS

You are looking for NotesSession.UserName (or NotesSession.CommonUserName) and Cstr(Now) (that’s "convert to string the current time value).

Subject: Thanks : onChange Simple LS

Thanks …

This works … :slight_smile:

Best regards