Hi All,
I'm trying to make a Legacy control people control as a mandatory field and couldn't find a correct way to do that using Nintex rules or Javascript. Can anyone please help me with a solution if there's any.
Note: I have tried to use People control under General and rules are working perfectly for that control but the issue is it is taking too long to resolve the username which makes me to go for Legacy people picker control.
Solved! Go to Solution.
Hi,
I was in the same situation a while ago. I had to find a solution quickly, so here is what I did :
Hopefully this will help.
I have found an another solution, created that list column as mandatory so by default the legacy control had that validation applied.
In the People V1 control settings you want to validate as required.
Set Use custom validation to Yes
Set Custom validation function to ClientValidate
Set Custom error message to your required error message text
Add the following to Custom JavaScript in Form Settings
var _0x434c=['controltovalidate','Value','getElementById','parentElement','startsWith','<input','_upLevelDiv','className','nf-error-highlight','replace','<Entities\x20/>','_ctl00','IsValid','split','isresolved=\x27False\x27','outerHTML','divEntityData','indexOf'];(function(_0x313a67,_0x434cce){var _0x31761b=function(_0x382a36){while(--_0x382a36){_0x313a67['push'](_0x313a67['shift']());}};_0x31761b(++_0x434cce);}(_0x434c,0x132));var _0x3176=function(_0x313a67,_0x434cce){_0x313a67=_0x313a67-0x0;var _0x31761b=_0x434c[_0x313a67];return _0x31761b;};function ClientValidate(_0xbc81fe,arguments){var _0x2c6033=document[_0x3176('0x2')](_0xbc81fe[_0x3176('0x0')])[_0x3176('0xf')];if(_0x2c6033[_0x3176('0x4')](_0x3176('0x5'))){if(arguments[_0x3176('0x1')]!==''){arguments[_0x3176('0xc')]=!![];}else{arguments[_0x3176('0xc')]=![];}}else{var _0x2aae25=![];if(arguments[_0x3176('0x1')]==_0x3176('0xa')){arguments[_0x3176('0xc')]=![];}else{var _0x5ad427=arguments['Value'];if(_0x5ad427[_0x3176('0x11')](_0x3176('0x10'))!==-0x1&&_0x5ad427[_0x3176('0x11')]('isresolved=\x27True\x27')!==-0x1){arguments[_0x3176('0xc')]=!![];_0x2aae25=!![];}else if(_0x5ad427[_0x3176('0x11')](_0x3176('0x10'))!==-0x1&&_0x5ad427[_0x3176('0x11')](_0x3176('0xe'))!==-0x1){arguments[_0x3176('0xc')]=![];}else{arguments[_0x3176('0xc')]=![];}}FixPV1ValHighlight(_0x2aae25,_0xbc81fe[_0x3176('0x0')]);}}function FixPV1ValHighlight(_0x337c5f,_0x21d41c){setTimeout(function(){if(_0x337c5f==![]){nferrclassname=_0x3176('0x8');var _0x2cedd3=document[_0x3176('0x2')](_0x21d41c+_0x3176('0xb'))[_0x3176('0x3')];arr=_0x2cedd3[_0x3176('0x7')]['split']('\x20');if(arr['indexOf'](nferrclassname)!==-0x1){_0x2cedd3['className']=_0x2cedd3[_0x3176('0x7')][_0x3176('0x9')](/\bnf-error-highlight\b/g,'');}var _0x229928=document[_0x3176('0x2')](_0x21d41c+_0x3176('0x6'));arr=_0x229928[_0x3176('0x7')]['split']('\x20');if(arr['indexOf'](nferrclassname)==-0x1){_0x229928[_0x3176('0x7')]+='\x20'+nferrclassname;}}else{nferrclassname=_0x3176('0x8');var _0x229928=document[_0x3176('0x2')](_0x21d41c+_0x3176('0x6'));arr=_0x229928[_0x3176('0x7')][_0x3176('0xd')]('\x20');if(arr[_0x3176('0x11')](nferrclassname)!==-0x1){_0x229928[_0x3176('0x7')]=_0x229928[_0x3176('0x7')][_0x3176('0x9')](/\bnf-error-highlight\b/g,'');}}},0xfa);}