Hi,
I’m trying to validate that there is something in field_A when Radio_A is set to Yes. But I only want to validate this when saving the form. What’s the best/most efficient way to do this? Assuming Radio_A is set to yes, if there is something in field_A then I just want it to save, if not, then I want a msg box to pop up saying that there must be content in field_A before saving, and then focus on field_A.
Thanks in advance…
Dan
Subject: Validation when saving form
Both the answers give above are right. The question is how you want the system to work. The problem with the Validation process is if you have a dozen fiedls that are required and no one has filled them in, you’re going to get a dozen message on the screen.
The Query Save (Lotus Script) method you can combine message to result in a single message like:
The following fields are required: First Name, Last Name, Field_A’s label, whever.
Subject: Validation when saving form
Hi,
Write your code in the QuerySave event of the form.
dim w as new notesuiworkspace
dim s as new notessession
dim db as notesdatabase
dim doc as notesdocument
dim uidoc as notesuidocument
set db = s.currentdatabase
set uidoc = w.currentdocument
set doc = uidoc.document
if doc.radio_A(0) = “Yes” And doc.field_A(0) = “” then
Msgbox “Please enter value for Field_A”
Exit Sub
End if
Hope this helps.
Subject: Validation when saving form
in the validation event for Field A
@if(@isdocbeingsaved & Radio_A = “yes” & Field_A = “”;@failure(“you need to fill field A”);@success)
Subject: RE: Validation when saving form
Awesome. thanks. Both work. I went with the last because I already have input validation on that field and I just replaced the “@success” with that line of code.
Thanks a lot.