Page 1 of 1

Check if People Picker field is empty.

Posted: 05 Aug 2014
by ching29
Hello,



I would like to ask how to validate people picker field if it is empty using javascript? I already have a validation for text but cannot seem to replicate it and use in peoplepicker field. Please help. Thanks.

I already read this http://spform.com/forms-designer- ... eld-values but still cant make it work.



Best Regards,

Erica

Re: Check if People Picker field is empty.

Posted: 06 Aug 2014
by Dmitry Kozlov
Hello Erica,

Here is the sample:

Code: Select all

if (fd.field('AssignedTo').value().dictionaryEntries.length == 0) {
// AssignedTo is empty
}
You can find more samples on how to validate fields, make them mandatory or hide them conditionally in the following post:
http://spform.com/office-365/cond ... ynamically

Re: Check if People Picker field is empty.

Posted: 07 Aug 2014
by ching29
Thanks for this Dmitry.. It really helped...!

Re: Check if People Picker field is empty.

Posted: 14 Dec 2015
by schuess
This worked for me when I had the field Render = Server, However, now I am using Render = Client, and the .value().dictionaryEntries.length == 0 validation check is not working.

Re: Check if People Picker field is empty.

Posted: 15 Dec 2015
by Dmitry Kozlov
Please, use the code below:

Code: Select all

if (fd.field('InternalName').value().length == 0) {
…
}