How to identify an invalid people picker value

Forums Classic DFFS How to identify an invalid people picker value

Viewing 2 reply threads
  • Author
    Posts
    • #34597
      Ivan Wilson
      Participant

      We have a form where we prefill a lot of the fields in code. We only display a subset of the fields in the form, depending on the scenario.

      We’ve run into an issue where we populate a hidden people picker field with an old value that is no longer valid. We want to be able to identify that the field is invalid and fix the issue without requiring the user to take any action. For this case, we can just clear the field.

      What is the best way to do this?

    • #34600
      Alexander Bautz
      Keymaster

      Hi,
      You can use something like this after you have filled in all the fields:

      setTimeout(function(){
          jQuery(".sp-peoplepicker-errorMsg").each(function(i, elm){
              var fin = jQuery(elm).parents("tr:first").attr("fieldinternalname");
              console.log("There is a validation error in this field: " + fin);
              setFieldValue(fin, "");
          });
      },1000);

      Alexander

    • #34602
      Ivan Wilson
      Participant

      Perfect, thanks Alexander

Viewing 2 reply threads
  • You must be logged in to reply to this topic.