Bug #20005
Empty String not equal to Null - create user profile
Status: | Feedback | Start date: | 07 March 2024 | ||
---|---|---|---|---|---|
Priority: | Normal | Due date: | |||
Assignee: | chok yee fan | % Done: | 50% | ||
Category: | - | Spent time: | - | ||
Target version: | - |
Description
blank space(" ") != null issue
front end(react) will send all empty fields as empty string("") to backend instead of null
Will check and research on this
History
#1 Updated by Zaid Haritsah 10 months ago
JSON Body by Reach on User Profile Create Action
{
"userProfileEntity": {
"catId": "3",
"departmentId": "1",
"fullName": "ioppppqw",
--> "personIdTypeId": "",
"personIdNumber": null,
"email": "hoas@gmail.com",
"mobileNumber": "6779323424",
"userId": "9865893043",
"status": "A",
"orgId": 2,
"effectiveDt": "2024-03-14T08:00:00.000+08:00",
"expiryDt": "2024-03-15T08:00:00.000+08:00",
--> "createDt": "",
--> "createBy": ""
},
"userProfileBean": {
"userId": "9865893043"
}
}
#2 Updated by Zaid Haritsah 10 months ago
- % Done changed from 0 to 50
Found that the default value is set to be empty string as react feature under react hook form.
proposed solution --> include validation to check if the input value is empty change to null.
setValue(inputValue === '' ? null : inputValue)
#3 Updated by Zaid Haritsah 10 months ago
- Assignee changed from Zaid Haritsah to Nityanantan Nityanantan
#4 Updated by Nityanantan Nityanantan 10 months ago
- Tracker changed from Clarification to Bug
- Status changed from New to Feedback
- Assignee changed from Nityanantan Nityanantan to Hazimi Muhammad
#5 Updated by Hazimi Muhammad 10 months ago
- Assignee changed from Hazimi Muhammad to chok yee fan
Issue has been fixed
Test for all pages by :
click the search button and the error is now gone
#6 Updated by chok yee fan 10 months ago
- Assignee changed from chok yee fan to Nityanantan Nityanantan
as per discuss, cannot put at axios. create another method, or let the caller to decide pass in null or ""
#7 Updated by Nityanantan Nityanantan 10 months ago
- Assignee changed from Nityanantan Nityanantan to Hazimi Muhammad
nity- Refactor removeEmptyStringField function to accept an array of fields to return empty string
#8 Updated by Hazimi Muhammad 10 months ago
- Assignee changed from Hazimi Muhammad to chok yee fan
Issue has been fixed
got no issue when testing by lick the search button and the error is now gone