Page 1 of 1

Value of user returns null in Chrome

Posted: 12 May 2016
by Alexey Babin
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.

Re: Value of user returns null in Chrome

Posted: 12 May 2016
by Dmitry Kozlov
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.

Re: Value of user returns null in Chrome

Posted: 12 May 2016
by Alexey Babin
In client side mode - as it was by default.

Re: Value of user returns null in Chrome

Posted: 12 May 2016
by Alexey Babin
Changed mode to server side and rewrite one line of - everything works! Thanks a lot!

Re: Value of user returns null in Chrome

Posted: 12 May 2016
by Dmitry Kozlov
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);
  }
});