 Validate richtxtfield in querysave Nadeem Shaikh 03/26/2003 07:28 PM Domino Designer -- LotusScript 4.6.4 Windows NT
Hi,
i need to resolve the following problem..can someone please help...
i have a button on a form whic has the following formula:
FIELD SaveCheck := "OK";
TErrNo := ErrorNo;
TenvVar := @Environment("DocIsSaved");
@Do(@Command([FileSave]));
@If(TenvVar = "1";
@Do(@PostedCommand([OpenView]; "(AllErrors)"; TErrNo);
@PostedCommand([Compose]; ""; "Error Notice");
@PostedCommand([ViewRefreshFields]);
@PostedCommand([FileSave]);
@PostedCommand([FileCloseWindow]);
@PostedCommand([FileCloseWindow]);
@PostedCommand([FileCloseWindow]));
@Prompt([OK];"Document was not saved";"Document was not saved Validation Failed."))
now when the first @command(filesave) (ie.@Do(@Command(filesave) above) is triggered..it runs the querysave event of the form..which has the following code:
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim session As New NotesSession
On Error Goto Errsub
Call session.SetEnvironmentVar( "DocIsSaved", "0" )
Call source.GoToField("ErrorScreenshot")
Call source.selectall
Call source.copy
Call source.deselectall
Goto OkExit
OkExit:
Call session.SetEnvironmentVar( "DocIsSaved", "1" )
Exit Sub
ErrSub:
If Err = 4407 Then
continue = False
Msgbox "You must enter a screenshot of the issue",48,"Error"
Call session.SetEnvironmentVar( "DocIsSaved", "0" )
End If
Resume OkExit
End Sub
the querysave event is not supposed to mail users and save the form if the richtextfield "ErrorScreenshot" is blank..but it seems to do it anyway..
i was assuming that when it does the call source.deselect it runs the goto errsub, which then brings up the messagebox "You must enter a screenshot of the issue".
Basically, i am trying to validate whether the richtextfield "ErrorScreenshot" is empty or not..if it is then it should not save the form but bring up an error message notifying the user that they must complete the richtextfield.
I understand i could use valuelength item property to check if the richtextfield is empty or not..how would i introduce that in my code...
can someone please tell me where i am going wrong or what is the best way to validate richtextfields in notes v4.6
Thanks
Nadeem Shaikh
Go back |