Yes/No Control Validation Issue - IsNullorEmpty Not Working

  • 8 August 2016
  • 5 replies
  • 4 views

Badge +2

I have a form with a number of yes/no controls.  I want a rule in place that makes sure at least one field is checked before the form can be saved.  I added a validation rule to the save button as per below:

isNullOrEmpty(HarmFinancialLoss) && isNullOrEmpty(HarmKeyTargetsUnderachieved) && isNullOrEmpty(HarmWastedHrs)

When I do a preview and try to test rule, I am still allowed to save.  This rule seems to work on a text box but not a yes/no control.  Does anybody know what I am doing wrong please?

189215_pastedImage_0.png

189216_pastedImage_1.png


5 replies

Badge +9

Hi,

You can try two things

  1. (HarmKeyTargetsUnderachieved)=="" &&isNullOrEmpty({Self}) (Select {Self} from the named controls.
  2. If this dont work do (HarmKeyTargetsUnderachieved)==''**SelectValue**''

If the above options still do not   give you results then add one calculated value in the form and connect it to yes no control to check the value when no option is selected

Badge +9

let me know which option works

Userlevel 5
Badge +14

since yes/no control has just two possible values - true/false, it's not considered to be empty in either of these cases, so isNullOrEmpty on yes/no control always evaluates to false.

but since yes/no values are directly boolean true/false values you can write formula on them like:

not(HarmFinancialLoss) && not(HarmKeyTargetsUnderachieved) &&  not(HarmWastedHrs​)

Badge +2

In the end I used the following:

HarmFinancialLoss==false && HarmKeyTargetsUnderachieved==false && HarmWastedHrs==false && HarmKeyRecordsOutofdate==false && HarmReputationEroded==false && HarmNegativePublicity==false && HarmRegulatoryAction==false && HarmLitigation==false && HarmInitiativesAbortedDeadlinesMissed==false && HarmOther==false

I added rule above to each yes/no control and worked like a charm.  Thanks to Marian Hatala, found out that "isnullorempty" does not work on a yes/no control as two possible answers so never blank.

Userlevel 5
Badge +14

glad to hear you managed to find a solution.

maybe you might consider not to assign the rule to every single yes/no control but rather to enclosing panel. the way you designed it, the same formula is evaluated plenty of times (pointlessly), which might affect form performance .

Reply