Wix code SDK Warning: The text parameter that is passed to the text method cannot be set to null or undefined.
export function Bowlers_beforeInsert(item, context) {
//TODO: write your code here…
let hookContext = context;
item.displayName = item.title + " " + item.lastName;
return item;
}
export function Bowlers_beforeUpdate(item, context) {
//TODO: write your code here…
let hookContext = context;
item.displayName = item.title + " " + item.lastName;
return item;
}
Hi Raymond,
Welcome to the wonderful world of WixCode.
It’s a little difficult to determine what’s wrong due to the lack of information. If I were to take a wild guess, I would guess that item.title or item.lastName are empty. Add the following statement to both functions to see what the values are:
console.log(item);
When you run your code, you’ll see the contents of item displayed in the Developer console. This will hopefully tell you whats going on.
Have a Happy New WixCode year,
Yisrael
Hi Yisrael,
Thanks for your reply.
here is what I wanted to do: I have a database that contain “FirstName”, “LastName” & “DisplayName”
in the form, I have both First name and last name as user input
what I want to do is once I click the button (submit) then, it will add both “First name & Last Name” into Display Name.
Can you advice what will be the coding for this?
Regards
Raymond
Hello Raymond,
You can use data hooks for that.
See more information here