Note that there are some explanatory texts on larger screens.

plurals
  1. POquerysave event validation
    primarykey
    data
    text
    <p>I have a form. The form fields are validated in the querysave event. The validation goes like this. I have some fields to be validated for its presence during save. i.e., when i click a check box and dont enter the details in its field, it should show a error message box while saving. The validation works fine for a new document. My question is</p> <ol> <li>how to make it work for both new document and edit mode? </li> <li>The error message is not getting displayed the second time when i click on save.i.e., when i click ok in the messagebox, dont enter data and click save, its getting saved. how to make it check for validation everytime when clicked on save.</li> </ol> <p>Kindly help me. Please dont mind if my questions are obvious and simple because i m a fresher. Thanks in advance.</p> <p>The script goes below, The first part calculating ref num for new docs and secong part validating fields,</p> <pre><code>Sub Querysave(Source As Notesuidocument, Continue As Variant) Dim w As New notesuiworkspace Dim uidoc As notesuidocument Set uidoc = w.CurrentDocument Dim SESS As New NotesSession Dim Doc As NotesDocument Dim RefView As NotesView Dim DB As NotesDatabase Dim RefDoc As NotesDocument Set DB = SESS.CurrentDatabase Set Doc = uidoc.Document Set RefView = DB.GetView("System\AutoNo") If uidoc.IsNewDoc = True Then Financial_year = Clng(Right$(Cstr(Year(Now)),3)) + 104 If Month(Now) &gt;= 4 Then Financial_year = Financial_year + 1 Application = "ST" DefKey$ = Cstr(Financial_year) DefNo&amp; = 0 Set RefDoc = RefView.GetDocumentByKey(DefKey$ , True) If Not(RefDoc Is Nothing) Then DefNo&amp; = Clng(Right$(RefDoc.SETTLEMENT_NO(0),5)) DefNo&amp; = DefNo&amp; + 1 RefNo$ = (Application + DefKey$) &amp; "-" &amp; Right$("00000" &amp; Cstr(DefNo&amp;) ,5) Doc.SETTLEMENT_NO= RefNo$ Doc.FinFlag="Finish" Call SESS.SetEnvironmentVar("ENV_SETT",Right$("00000" &amp; Cstr(DefNo&amp;) ,5)) Call uidoc.Refresh Else Exit Sub End If get_ex_rate get_cv_local set_flag Dim answer2 As Integer answer2% = Msgbox("Do you want to save this document?", 1, "Save") If answer2 = 1 Then Petro$= uidoc.FieldGetText("Park_Petro_Car") Vehicle$= uidoc.FieldGetText("Vehicle_No") Gifts$ = uidoc.FieldGetText("Gifts") Gifts_Ent$ = uidoc.FieldGetText("Gifts_Ent") Medical$ = uidoc.FieldGetText("Medical") Medical_Fee$ = uidoc.FieldGetText("Medical_Fee") Others$= uidoc.FieldGetText("Others") OS$= uidoc.FieldGetText("Others_Specify") Taxi$ = uidoc.FieldGetText("Taxi") Taxi_Fee$ = uidoc.FieldGetText("Taxi_Fee") If Petro$ &lt;&gt; "" And Vehicle$ = "" Then Msgbox "Please enter Vehicle No" , 16, "Vehicle No" Else If Gifts$ &lt;&gt; "" And Gifts_Ent$ = "" Then Msgbox "Please enter Guest/Co.Name" , 16, "Guest/Co.Name" Else If Medical$ &lt;&gt; "" And Medical_Fee$ = "" Then Msgbox "Please enter Medical_Fee" , 16, "Medical_Fee" Else If Taxi$ &lt;&gt; "" And Taxi_Fee$ = "" Then Msgbox "Please enter Taxi Fee" , 16, "Taxi Fee" Else If Others$ &lt;&gt; "" And OS$ = "" Then Msgbox "Please enter Others(Specify)" , 16, "Others (Specify)" End If End If End If End If End If End If If answer2 = 2 Then continue=False Exit Sub End If uidoc.Refresh 'uidoc.close </code></pre> <p>End Sub</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload