how to test that people picker is empty

  • 11 February 2016
  • 2 replies
  • 25 views

Badge +3


Hi all,

I need to check wether my people picker is empty or not (with javascript), or get the value entered by the user in a people picker.

I already tried :

NWF$('#'+myPeoplePickerID).text()

NWF$('.myPeoplePickerCSS').text()

No success...

Help would be appreciated

Patricia

Nintex forms Version: 1.9.0.0


2 replies

Badge +2

How about to set this field in the list as required?

The second option is something like this:

NWF$(".myPeoplePickerCSS div[class='ip-item']").text()

OR

NWF$(".myPeoplePickerCSS div[class='ip-item'] span div").text()

OR
many other options

// However, I would prefer this

if (NWF$(".myPeoplePickerCSS div[class='ip-item']").text().length == 0){

//do soemthing

}

Badge +3

Thanks Tomasz for your answer.

I can't set it as required because the user has to check a yes/no control (Approvalrequested), and the people picker is hidden when the form is loading. So I added a validation rule that checks if the yes/no control is checked and if and if the people picker (Approvers Update) is empty : and(Approvalrequested, isNullOrEmpty(Approvers Update))

This works fine.

Now I want to add a confirm message on the submit button click to inform the user that he is about to send an approval request.

Hope it is clear enough!

Reply