1
0
-1
I would like to display different validation messages for a specific field depending upon selections made in the form. Is this possible?
  1. Chantal Thomas
    Hi Matthew,
    This may be done using a 'Business Rule - Error' widget and setting the focus target to the specific field in question.
    Cheers

  2. Matthew White
    The validation messages are loaded by a dynamic data service. Will using a business rule work in that situation?
  3. Matthew White
    This also works, same caveat as above:
    try {
    evt.evtData.validationResult.errorMessage = "Field does not pass validation";
    } catch(e) {}
  4. Matthew White
    I've tested both of these methods and they both suffer from the same issue, once the field fails validation the message doesn't update until the field succeeds validation. This means that you can't use data from the field in the error message.
CommentAdd your comment...

1 answer

  1.  
    1
    0
    -1
    1. Chantal Thomas
      Hi Matthew,
      You can do something like this:
      var fieldValidations = sfcInternal.av_internal_getValidationModel().getValidationResultForNode(businessRuleError,false) //returns an array
      for (var i=0;i<fieldValidations.length;i++) {
      if (fieldValidations[i].errorType == "business-error") {
      fieldValidations[i].errorMessage = "my new message";
      }
      }

      This will need to be tested and checked to make sure that this matches your requirements. Also our standard sfcInternal disclaimer applies: the contents of sfcInternal is subject to change between versions and even in service packs.
      Cheers
    CommentAdd your comment...