How to identify an invalid people picker value
- This topic has 2 replies, 2 voices, and was last updated 5 years, 1 month ago by .
Viewing 2 reply threads
Viewing 2 reply threads
- You must be logged in to reply to this topic.
Home › Forums › Classic DFFS › How to identify an invalid people picker value
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?
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
Perfect, thanks Alexander