lib/common/forms-rule-engine.js
function validatorRadio(fieldValue, fieldDefinition, previousFieldValues, cb) {
      if (typeof(fieldValue) !== "string") {
        return cb(new Error("Expected submission to be string but got " + typeof(fieldValue)));
      }

      //Check value exists in the field definition
      if (!fieldDefinition.fieldOptions.definition.options) {
        return cb(new Error("No options exist for field " + fieldDefinition.name));
      }

      async.some(fieldDefinition.fieldOptions.definition.options, function(dropdownOption, cb) {
        //check if fieldValue and the label need to be escaped
        isSafeString(fieldValue) ? null : fieldValue = _.escape(fieldValue);
        isSafeString(dropdownOption.label) ? null : dropdownOption.label = _.escape(dropdownOption.label);
        return cb(dropdownOption.label === fieldValue);
      }, function(found) {
        if (!found) {
          return cb(new Error("Invalid option specified: " + fieldValue));
        } else {
          return cb();
        }
      });
    }
function validatorRadio(fieldValue, fieldDefinition, previousFieldValues, cb) {
      if (typeof(fieldValue) !== "string") {
        return cb(new Error("Expected submission to be string but got " + typeof(fieldValue)));
      }

      //Check value exists in the field definition
      if (!fieldDefinition.fieldOptions.definition.options) {
        return cb(new Error("No options exist for field " + fieldDefinition.name));
      }

      async.some(fieldDefinition.fieldOptions.definition.options, function(dropdownOption, cb) {
        //check if fieldValue and the label need to be escaped
        isSafeString(fieldValue) ? null : fieldValue = _.escape(fieldValue);
        isSafeString(dropdownOption.label) ? null : dropdownOption.label = _.escape(dropdownOption.label);
        return cb(dropdownOption.label === fieldValue);
      }, function(found) {
        if (!found) {
          return cb(new Error("Invalid option specified: " + fieldValue));
        } else {
          return cb();
        }
      });
    }
function validatorRadio ( fieldValue , fieldDefinition , previousFieldValues , cb ) { if ( typeof ( fieldValue ) !== "string" ) { return cb ( new Error ( "Expected submission to be string but got " + typeof ( fieldValue ) ) ) ; } //Check value exists in the field definition if ( ! fieldDefinition . fieldOptions . definition . options ) { return cb ( new Error ( "No options exist for field " + fieldDefinition . name ) ) ; } async . some ( fieldDefinition . fieldOptions . definition . options , function ( dropdownOption , cb ) { //check if fieldValue and the label need to be escaped isSafeString ( fieldValue ) ? null : fieldValue = _ . escape ( fieldValue ) ; isSafeString ( dropdownOption . label ) ? null : dropdownOption . label = _ . escape ( dropdownOption . label ) ; return cb ( dropdownOption . label === fieldValue ) ; } , function ( found ) { if ( ! found ) { return cb ( new Error ( "Invalid option specified: " + fieldValue ) ) ; } else { return cb ( ) ; } } ) ; }
validatorRadio - Validator function for radio fields.

@param  {string} fieldValue        The value to validate
@param  {object} fieldDefinition   Full JSON definition of the field
@param  {array} previousFieldValues Any values previously stored with the fields
@param  {function} cb               Callback function
validatorRadio - Validator function for radio fields .