Hi there,
I have the following code in my WebQuerySave. I know I could have used javascript for validation but for this case I need to do a server validation instead of client validation.
Anyway, what I want to achieve is this…
If the field ‘Title’ is empty, then an error message is displayed on a small pop-up and once user clicks o.k, window returs to the form with all the other information that I’ve keyed-in in other fields remain intact.
The problem is I get either the error message (see below) OR if the window did go back to the my previous forms, all the other items that I have keyed in is lost, except for the items that I keyed in a dialog box perhaps. But all items keyed in the text field are lost, that I’m sure.
Now I’ve read countless of articles in this forum about this issue but I just could not get a solution out of it. Some mentioned (I think it was Stan) about the use of session cookie, but I have no idea on how to program it that way.
Anyway thanks for your attention.
Cheers,
Below are my codes and the error messages…
Sub Initialize
Dim ss As notessession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set ss = New NotesSession
Set db = ss.CurrentDatabase
Set doc = ss.DocumentContext
Const fail_validation = 1001
On Error Goto Errorhandler
If doc.Title(0) = "" Then
doc.SaveOptions = "0"
Error fail_validation, "kindly enter the title."
Exit Sub
Else
doc.SaveOptions = "1"
Print {<script language="JavaScript">alert("Success !!!")}
Print {</script>}
Exit Sub
End If
ErrorHandler:
Print {<script language="JavaScript">alert('} + Error + {');}
Print {history.back();</script>}
End Sub
Warning: Page has Expired
The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.
To resubmit your information and view this Web page, click the Refresh button.