focus people picker field

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
coresoul
Posts: 23
Joined: Tue Feb 24, 2015

30 Mar 2015

how to i focus to people picker field on submit if that field is mandatory and left blank?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

30 Mar 2015

Please, set Render property of the field in Client in the Forms Designer. Next, you can use the following code to set focus to the field:

Code: Select all

fd.field('FieldName').control()._el().find('.sp-peoplepicker-editorInput').focus()

coresoul
Posts: 23
Joined: Tue Feb 24, 2015

30 Mar 2015

else if (fd.field('Project_x0020_Manager').value().dictionaryEntries.length == 0) {

alert('Please, fill in the Project Manager field.');

$('#fd_tabcontrol-0').tabs('option', 'active', 0);

fd.field('Project_x0020_Manager').control()._el().find('.sp-peoplepicker-editorInput').focus();

return false;

}


Am i doing something wrong?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

31 Mar 2015

Hi,

If you use People Picker field in the client-side rendering mode, please, check whether it is empty with the following code:

Code: Select all

fd.field('User').value().length == 0
http://spform.com/forms-designer- ... eld-values

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests