Calling uidoc.save in postrecalc event, gives nested events error

i have the following script:

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim item As NotesItem

Dim recdSubAgree As String

Dim recdQSR As String

Set uidoc = workspace.CurrentDocument

recdSubAgree =  uidoc.FieldGetText("recdSubAgree")

recdQSR = uidoc.FieldGetText("recdQSR")

If recdSubAgree <> "" And recdQSR <> ""  Then

	Dim text As String

	text = |You checked both SubAgree and QSR. Please check only one. |

	Msgbox text, MB_OK, "Alert"

	Call uidoc.FieldSetText("recdSubAgree","")

	Call uidoc.FieldSetText("recdSubAgreeConfirm","")

	'Call uidoc.FieldSetText("NotifyrecdSubAgree","")

	Call uidoc.FieldSetText("recdQSR","")

	Call uidoc.FieldSetText("filedQSRConfirm","")

	'Call uidoc.FieldSetText("NotifyrecdQSR","")

	Call uidoc.Refresh

When I try to run I get a message “ATTEMPT TO EXECUTE NESTED FORM EVENTS”. This only happens if I have the line “call uidoc.refresh”

Can someone help.

Jacob

Subject: calling uidoc.save in postrecalc event, gives nested events error

PostRecalc is fired on uidoc.refresh; you’d never get out of the loop.

Subject: When you have a uidoc.Refresh, it calls the routine that executes the PostRecalc event.

That is the “Circular” event. You would be in a continuous loop of PostRecalc, Refresh.

Subject: RE: When you have a uidoc.Refresh, it calls the routine that executes the PostRecalc event.

So If I want to test if fieldA is already set when I go to set fieldB, and in that case unset both fields and refresh the fields in the doc, How can I go about doing it. ?

Thanks

Subject: Use @Formulas and Input Validation.

in one of the fields…@If(ecdSubAgree != “” & recdQSR != “”; @Failure("You checked both SubAgree and QSR. Please check only one. "); @Success)

Subject: RE: When you have a uidoc.Refresh, it calls the routine that executes the PostRecalc event.

Use the Entering event of the field(s).

Subject: RE: When you have a uidoc.Refresh, it calls the routine that executes the PostRecalc event.

Thank you Stan for this tip. This saved my butt. :slight_smile:

regards,

ben perales