From 93e11c30aef45b75612073876fa0082409ced7b1 Mon Sep 17 00:00:00 2001 From: sandhya kurumanale Date: Thu, 12 May 2022 16:45:14 +0530 Subject: [PATCH] Delivery for Crowdsource Reporter AGOL10.2 - #532 ### Implemented - #532 --- js/widgets/comment-form/comment-form.js | 9 ++++++--- js/widgets/geo-form/geo-form.js | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/js/widgets/comment-form/comment-form.js b/js/widgets/comment-form/comment-form.js index 7449868..da4c0dd 100644 --- a/js/widgets/comment-form/comment-form.js +++ b/js/widgets/comment-form/comment-form.js @@ -1021,7 +1021,8 @@ define([ //if loggedInUser info is available and fields are configured then populate it with the user info if (this.loggedInUser !== null) { - if (this.config.firstNameField && this.config.firstNameField !== "" && currentField.type === "esriFieldTypeString" && + if (this.config.firstNameField && this.config.firstNameField !== "" && + currentField.type === "esriFieldTypeString" && this.loggedInUser.firstName && fieldname.toLowerCase() === this.config.firstNameField.toLowerCase()) { if (this.loggedInUser.firstName.length > currentField.length) { currentField.defaultValue = this.loggedInUser.firstName.slice(0, currentField.length); @@ -1029,7 +1030,8 @@ define([ currentField.defaultValue = this.loggedInUser.firstName; } } - if (this.config.lastNameField && this.config.lastNameField !== "" && currentField.type === "esriFieldTypeString" && + if (this.config.lastNameField && this.config.lastNameField !== "" && + currentField.type === "esriFieldTypeString" && this.loggedInUser.lastName && fieldname.toLowerCase() === this.config.lastNameField.toLowerCase()) { if (this.loggedInUser.lastName.length > currentField.length) { currentField.defaultValue = this.loggedInUser.lastName.slice(0, currentField.length); @@ -1037,7 +1039,8 @@ define([ currentField.defaultValue = this.loggedInUser.lastName; } } - if (this.config.emailField && this.config.emailField !== "" && currentField.type === "esriFieldTypeString" && + if (this.config.emailField && this.config.emailField !== "" && + currentField.type === "esriFieldTypeString" && this.loggedInUser.email && fieldname.toLowerCase() === this.config.emailField.toLowerCase()) { if (this.loggedInUser.email.length > currentField.length) { currentField.defaultValue = this.loggedInUser.email.slice(0, currentField.length); diff --git a/js/widgets/geo-form/geo-form.js b/js/widgets/geo-form/geo-form.js index 1d12937..0c38619 100644 --- a/js/widgets/geo-form/geo-form.js +++ b/js/widgets/geo-form/geo-form.js @@ -1135,7 +1135,8 @@ define([ } //if loggedInUser info is available and fields are configured then populate it with the user info if (this.loggedInUser !== null) { - if (this.config.firstNameField && this.config.firstNameField !== "" && currentField.type === "esriFieldTypeString" && + if (this.config.firstNameField && this.config.firstNameField !== "" && + currentField.type === "esriFieldTypeString" && this.loggedInUser.firstName && fieldname.toLowerCase() === this.config.firstNameField.toLowerCase()) { if (this.loggedInUser.firstName.length > currentField.length) { currentField.defaultValue = this.loggedInUser.firstName.slice(0, currentField.length); @@ -1143,7 +1144,8 @@ define([ currentField.defaultValue = this.loggedInUser.firstName; } } - if (this.config.lastNameField && this.config.lastNameField !== "" && currentField.type === "esriFieldTypeString" && + if (this.config.lastNameField && this.config.lastNameField !== "" && + currentField.type === "esriFieldTypeString" && this.loggedInUser.lastName && fieldname.toLowerCase() === this.config.lastNameField.toLowerCase()) { if (this.loggedInUser.lastName.length > currentField.length) { currentField.defaultValue = this.loggedInUser.lastName.slice(0, currentField.length); @@ -1151,7 +1153,8 @@ define([ currentField.defaultValue = this.loggedInUser.lastName; } } - if (this.config.emailField && this.config.emailField !== "" && currentField.type === "esriFieldTypeString" && + if (this.config.emailField && this.config.emailField !== "" && + currentField.type === "esriFieldTypeString" && this.loggedInUser.email && fieldname.toLowerCase() === this.config.emailField.toLowerCase()) { if (this.loggedInUser.email.length > currentField.length) { currentField.defaultValue = this.loggedInUser.email.slice(0, currentField.length);