I have a survey form with hundred of fields . Users who fill out the survey , if not done can click a Save button and come back later to complete it. But if they click a “Submit” button, I am supposed to stop them and point them back to the unfilled field .
For those required fields , I have this Input Validation :
@If( QAnswer_66 = “” & AssessmentDone = “Yes”;
@Failure( "You must provide an answer to this question.");
@Success)
where AssessmentDone is a field that will be set to “Yes” if users click on “Submit” . Here is my “Submit” button :
FIELD AssessmentDone := “Yes”;
@If(!@IsError(@Command([FileSave]));@Do(
@MailSend(“Hung Tran/Heaven/IBM”; “”; “”; "An assessment is completed "; “An assessment is done by " + @Name([CN];CreatedBy) + " To see the assessment double-click the doclink -->”; " "; [IncludeDoclink]);
@PostedCommand([FileCloseWindow]));@Return(“”))
An unfinished survey is indeed stopped and force to fill out the missing value , or just save it without submitting, but somehow the mail is sent (???).
What is wrong with my formula ? or the logic of it ? Please help . Many thanks in advance.
Just remove the @IsError around @Command([FileSave]). This command never returns an error value. It returns True if the save worked, False if it didn’t.
By the way, don’t forget: if the save doesn’t work, you must set AssessmentDone back to its default value. Otherwise it will still be “Yes” after the user presses Submit and gets a validation error, so you risk the user submitting by accident.
It’s actually better to send out email notices in a server agent. That way, you can make a newsletter of recent submissions (rather than getting an individual email for each submission), your form logic is simpler, and the user doesn’t have to wait for the mail to be sent.
Andre’s right. The use of @IsValid is redundant as I look at my suggestion (so I revised it below). I think I was trying to prevent the field from being set to an incorrect value before document validation but I guess I was up too late last night . . . speaking of which . . . Andre, aren’t you on EST? 1:07am??? Rough night?
PrvVal := AssessmentDone;
SendTo := “Hung Tran/Heaven/IBM”;
Subj := “An assessment is completed”;
MsgTxt := "An assessment is done by " + @Name([CN]; CreatedBy) + “. To see the assessment double-click the doclink -->”;