Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6833911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:02:36+00:00 2026-05-26T23:02:36+00:00

I have a form. The form fields are validated in the querysave event. The

  • 0

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

  1. how to make it work for both new document and edit mode?
  2. 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.

Kindly help me. Please dont mind if my questions are obvious and simple because i m a fresher. Thanks in advance.

The script goes below,
The first part calculating ref num for new docs and secong part validating fields,

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) >= 4 Then Financial_year = Financial_year + 1
    Application = "ST"
    DefKey$     = Cstr(Financial_year)
    DefNo&      =  0
    Set RefDoc  =  RefView.GetDocumentByKey(DefKey$ , True)
    If Not(RefDoc Is Nothing) Then DefNo& = Clng(Right$(RefDoc.SETTLEMENT_NO(0),5))
    DefNo&      =  DefNo& + 1
    RefNo$      =  (Application + DefKey$) & "-" & Right$("00000" & Cstr(DefNo&) ,5)
    Doc.SETTLEMENT_NO= RefNo$
    Doc.FinFlag="Finish"
    Call SESS.SetEnvironmentVar("ENV_SETT",Right$("00000" & Cstr(DefNo&) ,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$ <> "" And Vehicle$ = "" Then
        Msgbox "Please enter Vehicle No" , 16, "Vehicle No"
    Else 
        If  Gifts$ <> "" And Gifts_Ent$ = "" Then
            Msgbox "Please enter Guest/Co.Name" , 16, "Guest/Co.Name"
        Else
            If Medical$ <> "" And Medical_Fee$ = "" Then
                Msgbox "Please enter Medical_Fee" , 16, "Medical_Fee"
            Else
                If Taxi$ <> "" And Taxi_Fee$ = "" Then
                    Msgbox "Please enter Taxi Fee" , 16, "Taxi Fee"
                Else
                    If Others$ <> "" 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 

End Sub

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:02:37+00:00Added an answer on May 26, 2026 at 11:02 pm

    Remove the Else from your first IF Statement, otherwise the validation only runs once, when IsNewDoc returns True, once the doc has been saved once it will return False and your QuerySave Subroutine exits.

    ELSE
    Exit Sub <– remove this, your validation code only runs once per document.
    End IF

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have form, where some fields are looks like rows, so I can add/delete
I have a contact form and I have some fields that are validated by
I have a form in which some of the fields need to be validated
Say you have a web form with some fields that you want to validate
I have a form with multiple fields that I'm validating (some with methods added
Have a simple form (only extract fields here) but for some reason the JQserilization
I have a IceFaces-form and several input fields. Let's say I have this: <ice:selectOneMenu
I have this registration form which is then validated using "bassistance's" validate.js: $('#pForm').validate({ rules:
I have a form that have many text fields and all are being validated,
I have a HTML form with fields such as name, address, notes, etc. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.