Value of user returns null in Chrome
- Alexey Babin
- Posts: 23
- Joined: Wed May 11, 2016
- Contact:
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.
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.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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.
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.
- Alexey Babin
- Posts: 23
- Joined: Wed May 11, 2016
- Contact:
In client side mode - as it was by default.
- Alexey Babin
- Posts: 23
- Joined: Wed May 11, 2016
- Contact:
Changed mode to server side and rewrite one line of - everything works! Thanks a lot!
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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:
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);
}
});
-
- Information
-
Who is online
Users browsing this forum: No registered users and 11 guests