Clear People Picker that is Disabled by rule


Badge +2

I have a PeoplePicker control that I have disabled by rule because I am populating it via jQuery based on a selection in a drop down list.  I am using the NF.peoplePickerApi to set the value, which works fine.  However, if I change the value of the drop down list, the field does not clear and I get more than one name in the field which causes an error.  If the field is NOT disabled, the code works properly but I need the field disabled so it isn't modified manually by a user.

Is it by design that the clear method doesn't work if the field is read only?  Is there another way to clear the field?


5 replies

Userlevel 5
Badge +14

how do you disable it? by a control's appearance setting or by  a formatting rule?

I would recommend to use rule.

furthermore, do not apply the rule directly on control but rather place control into a panel and apply rule to the panel.

Badge

Hello,

try to disable it by JS so nobody can make changes but you can interact with the control.

NWF$('#'+pplDisabled).prop("readonly", true);

Cheers,

Badge +5

Tried this and it didn't work. 

Nintex Forms 2013 v2.10.0.0

Badge +5

Tried this and it didn't work. 

Nintex Forms 2013 v2.10.0.0

Badge +5

My workaround uses a yes/no control (on a hidden panel) that disables the person control when yes.  I'm using javascript to uncheck this control to enable the person control that then allow the clear function to work.  Once this has been completed then check the control to disable the person control.

var PersonControl = new NF.PeoplePickerApi("#"+TheseUsers);
NWF$('#'+PersonControlDisable).click();
PersonControl.clear();  
NWF$('#'+PersonControlDisable).click();

Reply