April 27, 2024

MoDCore

Welcome to the core

Question Validation Codes

Date picker, has to be X days in the future from today
Exact date is a picker for the user, change anything in bold to fit your needs
 
var a = f(“exact_date“).toDate();
var today : DateTime = DateTime.Now;
var todayPlus7 : DateTime = today.AddDays(7);
  if(a < todayPlus7) {
     RaiseError();
     SetQuestionErrorMessage(2057, “Please enter a date 7 days in the future”);
}
 
 
Check Dropdown for values
If a user inputted value on ana open question matches a varible set.
var consultants = (‘Matts Builders‘);
if(f(‘qnr_consult_other_name‘) == consultants);
  {
    RaiseError();
    SetQuestionErrorMessage(9,”This consultant appears to be in the dropdown list”);
}
Check a number field + question answer to raise error message 
if(f(‘qnr_Num_unacceptable‘).toNumber()==0)
{ if(f(‘question5‘).any(‘2‘))
{
RaiseError();
SetQuestionErrorMessage(2057,”There has been no unacceptable ratings in this QA, please go back and review”);
}
}
Check a single for either answers are then check a multi
var topq = f(‘qnr_CM_Proactivity’)
var impr = f(‘qnr_CM_Proactivity_improvement’)if(impr == ‘6’){
if(topq !=’1′) {
if(topq != ‘4’)
{
RaiseError();
SetQuestionErrorMessage(2057,”No unacceptable rating has been given for this question – if the EDM file is not clear and update to date or if the EDM management and document title guidance has not been followed then this must lead to an unacceptable rating for this question“);
}
}
}
This is checking if the number of unacceptable variable is 0 AND then if question5 has been answered as code 2. If both of these conditions are met, the error will fire when they try to progress to the next page.
Check a single for answer, and then if a multi has not been 
if(f(‘qnr_postm_aaa_rating’)==’3′) – “Room for Improvement is the 3rd option”

{
if(!f(‘qnr_postm_aaa_impr’).toBoolean()) “Two check boxs are the multi”
{
RaiseError();
SetQuestionErrorMessage(2057,”Error yo“); “Raise the error”
}
}

Copyright © All rights reserved. | Newsphere by AF themes.