Field value not saved

Hi,

I have a field with an exit script, but the value is not saved if the field is not the value it checks for.

The field I’m doing the Exit script on is called Report_2, it has Option A and Option B. However, if Option A is selected, it doesn’t save the value?

My Script:

Sub Exiting(Source as field)

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = ws.CurrentDocument

Dim thisfield As String

Dim typefield As String

thisfield = uidoc.FieldGetText(“Report_2”)

If thisfield = “Option B” Then

Messagebox "You have selected Option B.  Please select another Type at the top."

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

End If

Call uidoc.Refresh

End Sub

Subject: Field value not saved

Sorry, forgot to mention. The field Report_2 is a radio button field.

Subject: Field value not saved

Just out of curiosity: why do you offer your users an option (B) they cannot select?

The script is not the reason that option A is not stored in the field. If I create a form with your field and exiting code, option A is saved and option B is cleared. You’ll have to look somewhere else in your code. Does the field have an input translation? Or is the field set on another place?

Another thing to take in mind: the exiting code is executed when you move to another field. If you click on option B and then save the document, the focus is still on the field and the exiting code will not be executed and the value of report_2 will be Option B.

Regards,

René

Subject: RE: Field value not saved

Thanks Rene,

Reason, who knows, that was the user’s request. And unfortunately is not up for negotiation.

There is no input translation, default value or anything on the field. Strange that it works for you, but not or me :frowning:

Subject: RE: Field value not saved

A field can be set anywhere, did you check the queryclose event, querysave, etc, etc. Savest way to find out is to check all your code for “report_2” and see where it is set.