Value of user returns null in Chrome

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
Alexey Babin
Posts: 23
Joined: Wed May 11, 2016
Contact:

12 May 2016

Hello!

I faced to issue in Chrome - when I try to get value from field, which type is user, with statement fd.field('UserField').value() function returns null in Chrome. In IE everything is OK.

It seems that something is not loaded when I call value() method during form initialization, because in brouser console everething works fine - afetr whole page is loaded.

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

12 May 2016

Hi,

Do you use the user field in the server or client side mode? You can find this property in the list of properties of the field in Forms Designer.

User avatar
Alexey Babin
Posts: 23
Joined: Wed May 11, 2016
Contact:

12 May 2016

In client side mode - as it was by default.

User avatar
Alexey Babin
Posts: 23
Joined: Wed May 11, 2016
Contact:

12 May 2016

Changed mode to server side and rewrite one line of - everything works! Thanks a lot!

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

12 May 2016

Your issue isn't to do with Chrome, and it's not really an issue at all. You're right, you're calling .value() when the field is not yet initialized hence it's returning null. You can use a callback function to get the values when the field is initialized however. Example from
http://spform.com/forms-designer- ... eld-values:

Code: Select all

fd.field('User').control('ready', function() {
  var selectedUsers = fd.field('User').value();
  for (var i = 0; i < selectedUsers.length; i++) {
    alert('Login: ' + selectedUsers[i].Key);
  }
});

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests